@@ -309,6 +309,7 @@ def smarter_request_reload(desc):
309309
310310 self .request_paint_to_clear_screen = False # next paint should clear screen
311311 self .inconsistent_history = False # offscreen command yields different result from history
312+ self .history_messed_up = True # history error message displayed
312313 self .last_events = [None ] * 50 # some commands act differently based on the prev event
313314 # this list doesn't include instances of event.Event,
314315 # only keypress-type events (no refresh screen events etc.)
@@ -1022,27 +1023,30 @@ def paint(self, about_to_exit=False, user_quit=False):
10221023 arr = FSArray (0 , width )
10231024 #TODO test case of current line filling up the whole screen (there aren't enough rows to show it)
10241025 if self .inconsistent_history == False & current_line_start_row >= 0 :
1026+ logger .debug ("start %i" ,current_line_start_row )
10251027 history = paint .paint_history (current_line_start_row , width , self .lines_for_display )
10261028 arr [:history .height ,:history .width ] = history
10271029
10281030 else :
10291031 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 ]]
10331032 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 ]]
10341037 # self.scroll_offset -= 1
1038+
10351039 current_line_start_row = len (self .lines_for_display )- max (- 1 , self .scroll_offset )
10361040
10371041 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
10401044 arr [0 , 0 :min (len (msg ), width )] = [msg [:width ]]
10411045
10421046 # 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 )
10461050
10471051 history = paint .paint_history (max (0 , current_line_start_row - 1 ), width , self .lines_for_display )
10481052 arr [1 :history .height + 1 ,:history .width ] = history
@@ -1256,17 +1260,19 @@ def reevaluate(self, insert_into_history=False):
12561260 self .process_event (events .RefreshRequestEvent ())
12571261 sys .stdin = self .stdin
12581262 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 ]
12661270
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+
12681274 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))
12701276
12711277 self .cursor_offset = 0
12721278 self .current_line = ''
0 commit comments