4646
4747#TODO other autocomplete modes (also fix in other bpython implementations)
4848
49+
4950from curtsies .configfile_keynames import keymap as key_dispatch
51+ print 'hello'
5052
5153logger = logging .getLogger (__name__ )
5254
@@ -87,6 +89,7 @@ def __init__(self, coderunner, repl, configured_edit_keys=None):
8789
8890 def process_event (self , e ):
8991 assert self .has_focus
92+
9093 logger .debug ('fake input processing event %r' , e )
9194 if isinstance (e , events .PasteEvent ):
9295 for ee in e .events :
@@ -100,6 +103,9 @@ def process_event(self, e):
100103 self .current_line = ''
101104 self .cursor_offset = 0
102105 self .repl .run_code_and_maybe_finish ()
106+ elif e in ("<Esc+.>" ,):
107+ self .last_word ()
108+
103109 elif e in ["<ESC>" ]:
104110 pass
105111 elif e in ['<Ctrl-d>' ]:
@@ -469,6 +475,8 @@ def process_key_event(self, e):
469475 self .down_one_line ()
470476 elif e in ("<Ctrl-d>" ,):
471477 self .on_control_d ()
478+ elif e in ("<Esc+.>" ,):
479+ self .last_word ()
472480 elif e in ("<Esc+r>" ,):
473481 self .incremental_search (reverse = True )
474482 elif e in ("<Esc+s>" ,):
@@ -524,6 +532,12 @@ def process_key_event(self, e):
524532 else :
525533 self .add_normal_character (e )
526534
535+ def last_word (self ):
536+ the_history = self .rl_history .entries
537+ the_line = the_history .pop ()
538+ the_word = the_line .split ().pop ()
539+ self .current_line = self .current_line + the_word
540+
527541 def incremental_search (self , reverse = False , include_current = False ):
528542 if self .special_mode == None :
529543 self .rl_history .enter (self .current_line )
0 commit comments