@@ -309,6 +309,7 @@ def smarter_request_reload(desc):
309
309
310
310
self .request_paint_to_clear_screen = False # next paint should clear screen
311
311
self .inconsistent_history = False # offscreen command yields different result from history
312
+ self .history_messed_up = True # history error message displayed
312
313
self .last_events = [None ] * 50 # some commands act differently based on the prev event
313
314
# this list doesn't include instances of event.Event,
314
315
# only keypress-type events (no refresh screen events etc.)
@@ -1022,27 +1023,30 @@ def paint(self, about_to_exit=False, user_quit=False):
1022
1023
arr = FSArray (0 , width )
1023
1024
#TODO test case of current line filling up the whole screen (there aren't enough rows to show it)
1024
1025
if self .inconsistent_history == False & current_line_start_row >= 0 :
1026
+ logger .debug ("start %i" ,current_line_start_row )
1025
1027
history = paint .paint_history (current_line_start_row , width , self .lines_for_display )
1026
1028
arr [:history .height ,:history .width ] = history
1027
1029
1028
1030
else :
1029
1031
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
1032
self .inconsistent_history = False
1033
+ #if INCONSISTENT_HISTORY_MSG not in self.display_lines:
1034
+ logger .debug (INCONSISTENT_HISTORY_MSG )
1035
+ msg = INCONSISTENT_HISTORY_MSG
1036
+ arr [0 , 0 :min (len (msg ), width )] = [msg [:width ]]
1034
1037
# self.scroll_offset -= 1
1038
+
1035
1039
current_line_start_row = len (self .lines_for_display )- max (- 1 , self .scroll_offset )
1036
1040
1037
1041
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--->"
1042
+ logger .debug (CONTIGUITY_BROKEN_MSG )
1043
+ msg = CONTIGUITY_BROKEN_MSG
1040
1044
arr [0 , 0 :min (len (msg ), width )] = [msg [:width ]]
1041
1045
1042
1046
# move screen back up a screen minus a line
1043
- while current_line_start_row < 0 :
1044
- self .scroll_offset = self .scroll_offset - self .height
1045
- current_line_start_row = len (self .lines_for_display ) - max (- 1 , self .scroll_offset )
1047
+ while current_line_start_row < 0 :
1048
+ self .scroll_offset = self .scroll_offset - self .height
1049
+ current_line_start_row = len (self .lines_for_display ) - max (- 1 , self .scroll_offset )
1046
1050
1047
1051
history = paint .paint_history (max (0 , current_line_start_row - 1 ), width , self .lines_for_display )
1048
1052
arr [1 :history .height + 1 ,:history .width ] = history
@@ -1256,17 +1260,19 @@ def reevaluate(self, insert_into_history=False):
1256
1260
self .process_event (events .RefreshRequestEvent ())
1257
1261
sys .stdin = self .stdin
1258
1262
self .reevaluating = False
1259
- num_lines_onscreen = len ( self . lines_for_display ) - max ( 0 , self . scroll_offset )
1260
- old_display_lines_offscreen = []
1261
- display_lines_offscreen = []
1262
-
1263
- if old_display_lines [:len (self .display_lines )- num_lines_onscreen ]!= self .display_lines :
1264
- old_display_lines_offscreen = old_display_lines [:len (self .display_lines )- num_lines_onscreen ]
1265
- display_lines_offscreen = self .display_lines [:- num_lines_onscreen ]
1263
+
1264
+ num_lines_onscreen = len ( self . lines_for_display ) - max ( 0 , self . scroll_offset )
1265
+ old_display_lines_offscreen = []
1266
+ display_lines_offscreen = []
1267
+ if old_display_lines [:len (self .display_lines ) - num_lines_onscreen ]!= self .display_lines :
1268
+ old_display_lines_offscreen = old_display_lines [:len (self .display_lines ) - num_lines_onscreen ]
1269
+ display_lines_offscreen = self .display_lines [:- num_lines_onscreen ]
1266
1270
1267
- if old_display_lines_offscreen != display_lines_offscreen :
1271
+ if old_display_lines_offscreen != display_lines_offscreen :
1272
+ self .scroll_offset = self .scroll_offset - (len (old_display_lines )- len (self .display_lines ))
1273
+
1268
1274
self .inconsistent_history = True
1269
- self .scroll_offset = self .scroll_offset - max (- 1 ,(len (old_display_lines_offscreen )- len (display_lines_offscreen )+ 1 ))
1275
+ # self.scroll_offset = self.scroll_offset - max(-1,(len(old_display_lines_offscreen)-len(display_lines_offscreen)+1))
1270
1276
1271
1277
self .cursor_offset = 0
1272
1278
self .current_line = ''
0 commit comments