@@ -759,7 +759,8 @@ def paint(self, about_to_exit=False, user_quit=False):
759759
760760 lines = paint .display_linize (self .current_cursor_line + 'X' , width )
761761 # extra character for space for the cursor
762- cursor_row = current_line_start_row + len (lines ) - 1
762+ current_line_end_row = current_line_start_row + len (lines ) - 1
763+ cursor_row = current_line_start_row + (len (self .current_cursor_line ) - len (self ._current_line ) + self .cursor_offset_in_line ) / width
763764 if self .stdin .has_focus :
764765 cursor_column = (len (self .current_stdouterr_line ) + self .stdin .cursor_offset_in_line ) % width
765766 assert cursor_column >= 0 , cursor_column
@@ -773,15 +774,15 @@ def paint(self, about_to_exit=False, user_quit=False):
773774 if self .list_win_visible :
774775 logging .debug ('infobox display code running' )
775776 visible_space_above = history .height
776- visible_space_below = min_height - cursor_row - 1
777+ visible_space_below = min_height - current_line_end_row - 1
777778
778779 info_max_rows = max (visible_space_above , visible_space_below )
779780 infobox = paint .paint_infobox (info_max_rows , int (width * self .config .cli_suggestion_width ), self .matches , self .argspec , self .current_word , self .docstring , self .config )
780781
781782 if visible_space_above >= infobox .height and self .config .curtsies_list_above :
782783 arr [current_line_start_row - infobox .height :current_line_start_row , 0 :infobox .width ] = infobox
783784 else :
784- arr [cursor_row + 1 :cursor_row + 1 + infobox .height , 0 :infobox .width ] = infobox
785+ arr [current_line_end_row + 1 :current_line_end_row + 1 + infobox .height , 0 :infobox .width ] = infobox
785786 logging .debug ('slamming infobox of shape %r into arr of shape %r' , infobox .shape , arr .shape )
786787
787788 logging .debug ('about to exit: %r' , about_to_exit )
0 commit comments