@@ -1021,15 +1021,23 @@ def paint(self, about_to_exit=False, user_quit=False):
1021
1021
else :
1022
1022
arr = FSArray (0 , width )
1023
1023
#TODO test case of current line filling up the whole screen (there aren't enough rows to show it)
1024
- if self .inconsistent_history == True :
1025
- msg = "#<---History inconsistent with output shown--->"
1026
- arr [0 , 0 :min (len (msg ), width )] = [msg [:width ]]
1027
- self .inconsistent_history = False
1028
- """FIX THE THING This if may need to go after the second one, but the while applies to both"""
1029
- if current_line_start_row < 0 : #if current line trying to be drawn off the top of the screen
1030
- logger .debug ('#<---History contiguity broken by rewind--->' )
1031
- msg = "#<---History contiguity broken by rewind--->"
1032
- arr [0 , 0 :min (len (msg ), width )] = [msg [:width ]]
1024
+ if self .inconsistent_history == False & current_line_start_row >= 0 :
1025
+ history = paint .paint_history (current_line_start_row , width , self .lines_for_display )
1026
+ arr [:history .height ,:history .width ] = history
1027
+
1028
+ else :
1029
+ if self .inconsistent_history == True :
1030
+ logger .debug ("#<---History inconsistent with output shown--->" )
1031
+ msg = "#<---History inconsistent with output shown--->"
1032
+ arr [0 , 0 :min (len (msg ), width )] = [msg [:width ]]
1033
+ self .inconsistent_history = False
1034
+ # self.scroll_offset -= 1
1035
+ current_line_start_row = len (self .lines_for_display )- max (- 1 , self .scroll_offset )
1036
+
1037
+ if current_line_start_row < 0 : #if current line trying to be drawn off the top of the screen
1038
+ logger .debug ('#<---History contiguity broken by rewind--->' )
1039
+ msg = "#<---History contiguity broken by rewind--->"
1040
+ arr [0 , 0 :min (len (msg ), width )] = [msg [:width ]]
1033
1041
1034
1042
# move screen back up a screen minus a line
1035
1043
while current_line_start_row < 0 :
@@ -1041,9 +1049,7 @@ def paint(self, about_to_exit=False, user_quit=False):
1041
1049
1042
1050
if arr .height <= min_height :
1043
1051
arr [min_height , 0 ] = ' ' # force scroll down to hide broken history message
1044
- else :
1045
- history = paint .paint_history (current_line_start_row , width , self .lines_for_display )
1046
- arr [:history .height ,:history .width ] = history
1052
+
1047
1053
1048
1054
current_line = paint .paint_current_line (min_height , width , self .current_cursor_line )
1049
1055
if user_quit : # quit() or exit() in interp
@@ -1252,7 +1258,12 @@ def reevaluate(self, insert_into_history=False):
1252
1258
self .reevaluating = False
1253
1259
num_lines_onscreen = len (self .lines_for_display )- max (0 , self .scroll_offset )
1254
1260
if old_display_lines [:len (self .display_lines )- num_lines_onscreen ]!= self .display_lines :
1261
+ old_display_lines_offscreen = old_display_lines [:len (self .display_lines )- num_lines_onscreen ]
1262
+ display_lines_offscreen = self .display_lines [:- num_lines_onscreen ]
1263
+
1264
+ if old_display_lines_offscreen != display_lines_offscreen :
1255
1265
self .inconsistent_history = True
1266
+ self .scroll_offset = self .scroll_offset - max (- 1 ,(len (old_display_lines_offscreen )- len (display_lines_offscreen )+ 1 ))
1256
1267
self .cursor_offset = 0
1257
1268
self .current_line = ''
1258
1269
0 commit comments