@@ -769,16 +769,17 @@ def paint(self, about_to_exit=False, user_quit=False):
769769 lines = paint .display_linize (self .current_cursor_line + 'X' , width )
770770 # extra character for space for the cursor
771771 current_line_end_row = current_line_start_row + len (lines ) - 1
772- cursor_row = current_line_start_row + ( len ( self . current_cursor_line ) - len ( self . _current_line ) + self . cursor_offset_in_line ) / width
772+
773773 if self .stdin .has_focus :
774- cursor_column = (len (self .current_stdouterr_line ) + self .stdin .cursor_offset_in_line ) % width
774+ cursor_row , cursor_column = divmod (len (self .current_stdouterr_line ) + self .stdin .cursor_offset_in_line , width )
775775 assert cursor_column >= 0 , cursor_column
776- elif self .coderunner .running :
777- cursor_column = (len (self .current_cursor_line ) + self .cursor_offset_in_line ) % width
776+ elif self .coderunner .running : #TODO does this ever happen?
777+ cursor_row , cursor_column = divmod (len (self .current_cursor_line ) + self .cursor_offset_in_line , width )
778778 assert cursor_column >= 0 , (cursor_column , len (self .current_cursor_line ), len (self ._current_line ), self .cursor_offset_in_line )
779779 else :
780- cursor_column = (len (self .current_cursor_line ) - len (self ._current_line ) + self .cursor_offset_in_line ) % width
780+ cursor_row , cursor_column = divmod (len (self .current_cursor_line ) - len (self ._current_line ) + self .cursor_offset_in_line , width )
781781 assert cursor_column >= 0 , (cursor_column , len (self .current_cursor_line ), len (self ._current_line ), self .cursor_offset_in_line )
782+ cursor_row += current_line_start_row
782783
783784 if self .list_win_visible :
784785 logging .debug ('infobox display code running' )
0 commit comments