@@ -496,6 +496,7 @@ def add_normal_character(self, char):
496496 def update_completion (self , tab = False ):
497497 """Update autocomplete info; self.matches_iter and self.argspec"""
498498 self .list_win_visible = BpythonRepl .complete (self , tab )
499+ #look for history stuff
499500
500501 def push (self , line , insert_into_history = True ):
501502 """Push a line of code onto the buffer, start running the buffer
@@ -677,13 +678,22 @@ def display_line_with_prompt(self):
677678 func_for_letter (self .config .color_scheme ['prompt_more' ])(self .ps2 )) + self .current_line_formatted
678679
679680 @property
680- def current_cursor_line (self ):
681+ def current_cursor_line_without_suggestion (self ):
681682 """Current line, either output/input or Python prompt + code"""
682683 value = (self .current_output_line +
683684 ('' if self .coderunner .running else self .display_line_with_prompt ))
684685 logging .debug ('current cursor line: %r' , value )
685686 return value
686687
688+ @property
689+ def current_cursor_line (self ):
690+ return self .current_cursor_line_without_suggestion + fmtfuncs .bold (fmtfuncs .dark ((self .current_suggestion )))
691+
692+ @property
693+ def current_suggestion (self ):
694+ matches = [e for e in self .rl_history .entries if e .startswith (self .current_line )]
695+ return matches [0 ][len (self .current_line ):] if matches else ''
696+
687697 @property
688698 def current_output_line (self ):
689699 """line of output currently being written, and stdin typed"""
@@ -759,13 +769,13 @@ def paint(self, about_to_exit=False, user_quit=False):
759769 current_line_end_row = current_line_start_row + len (lines ) - 1
760770
761771 if self .stdin .has_focus :
762- cursor_row , cursor_column = divmod (len (self .current_stdouterr_line ) + self .stdin .cursor_offset , width )
772+ cursor_row , cursor_column = divmod (len (self .current_stdouterr_line_without_suggestion ) + self .stdin .cursor_offset , width )
763773 assert cursor_column >= 0 , cursor_column
764774 elif self .coderunner .running : #TODO does this ever happen?
765- cursor_row , cursor_column = divmod (len (self .current_cursor_line ) + self .cursor_offset , width )
775+ cursor_row , cursor_column = divmod (len (self .current_cursor_line_without_suggestion ) + self .cursor_offset , width )
766776 assert cursor_column >= 0 , (cursor_column , len (self .current_cursor_line ), len (self .current_line ), self .cursor_offset )
767777 else :
768- cursor_row , cursor_column = divmod (len (self .current_cursor_line ) - len (self .current_line ) + self .cursor_offset , width )
778+ cursor_row , cursor_column = divmod (len (self .current_cursor_line_without_suggestion ) - len (self .current_line ) + self .cursor_offset , width )
769779 assert cursor_column >= 0 , (cursor_column , len (self .current_cursor_line ), len (self .current_line ), self .cursor_offset )
770780 cursor_row += current_line_start_row
771781
0 commit comments