@@ -532,14 +532,21 @@ def process_key_event(self, e):
532532 self .add_normal_character (e )
533533
534534 def get_last_word (self ):
535- last_history_entry = self .rl_history .back ()
536- print 'last_history_entry' , last_history_entry
537- # last_word = last_history_entry.split().pop()
538- # print 'last_word', last_word
535+ entry = self .rl_history .entry
539536
540- # print 'first', self.cursor_offset
537+ self .current_line = self .current_line [:- len (entry )]
538+
539+ self ._set_cursor_offset (self .cursor_offset - len (entry ))
541540
541+ last_history_entry = self .rl_history .back ()
542+
543+ last_word = last_history_entry .split ().pop ()
544+
545+ # print 'first', self.cursor_offset
546+ self .current_line = self .current_line + last_word
542547
548+ self ._set_cursor_offset (self .cursor_offset + len (last_word ))
549+ #print len(self.rl_history.entry)
543550
544551 # self._set_cursor_offset(remember_cursor_offset)
545552 # print 'second', self.cursor_offset
@@ -828,7 +835,8 @@ def run_code_and_maybe_finish(self, for_code=None):
828835 if err :
829836 indent = 0
830837
831- #TODO This should be printed ABOVE the error that just happened instead
838+
839+ #TODO This should be printed ABOVE the error that just happened instead
832840 # or maybe just thrown away and not shown
833841 if self .current_stdouterr_line :
834842 self .display_lines .extend (paint .display_linize (self .current_stdouterr_line , self .width ))
0 commit comments