@@ -1018,7 +1018,7 @@ def paint(self, about_to_exit=False, user_quit=False):
10181018 else :
10191019 arr = FSArray (0 , width )
10201020 #TODO test case of current line filling up the whole screen (there aren't enough rows to show it)
1021- if self .inconsistent_history == False & current_line_start_row >= 0 :
1021+ if self .inconsistent_history == False and current_line_start_row >= 0 :
10221022 logger .debug ("start %i" ,current_line_start_row )
10231023 history = paint .paint_history (current_line_start_row , width , self .lines_for_display )
10241024 arr [:history .height ,:history .width ] = history
@@ -1031,7 +1031,7 @@ def paint(self, about_to_exit=False, user_quit=False):
10311031 msg = INCONSISTENT_HISTORY_MSG
10321032 arr [0 , 0 :min (len (msg ), width )] = [msg [:width ]]
10331033 # self.scroll_offset -= 1
1034-
1034+
10351035 current_line_start_row = len (self .lines_for_display )- max (- 1 , self .scroll_offset )
10361036 self .inconsistent_history = False
10371037 if current_line_start_row < 0 : #if current line trying to be drawn off the top of the screen
@@ -1244,19 +1244,16 @@ def reevaluate(self, insert_into_history=False):
12441244 self .process_event (events .RefreshRequestEvent ())
12451245 sys .stdin = self .stdin
12461246 self .reevaluating = False
1247-
1248- num_lines_onscreen = len (self .lines_for_display ) - max (0 , self .scroll_offset )
1249- old_display_lines_offscreen = []
1250- display_lines_offscreen = []
1251- if old_display_lines [:len (self .display_lines ) - num_lines_onscreen ]!= self .display_lines :
1252- old_display_lines_offscreen = old_display_lines [:len (self .display_lines ) - num_lines_onscreen ]
1253- display_lines_offscreen = self .display_lines [:- num_lines_onscreen ]
1254-
1255- if old_display_lines_offscreen != display_lines_offscreen and self .history_messed_up == False :
1256- self .scroll_offset = self .scroll_offset - (len (old_display_lines )- len (self .display_lines ))
12571247
1248+ num_lines_onscreen = len (self .lines_for_display ) - max (0 , self .scroll_offset )
1249+ display_lines_offscreen = self .display_lines [:len (self .display_lines ) - num_lines_onscreen ]
1250+ old_display_lines_offscreen = old_display_lines [:len (self .display_lines ) - num_lines_onscreen ]
1251+ logger .debug ('old_display_lines_offscreen %r' , old_display_lines_offscreen )
1252+ logger .debug ('display_lines_offscreen %r' , display_lines_offscreen )
1253+ if old_display_lines_offscreen [:len (display_lines_offscreen )] != display_lines_offscreen and self .history_messed_up == False :
1254+ self .scroll_offset = self .scroll_offset - (len (old_display_lines )- len (self .display_lines ))
12581255 self .inconsistent_history = True
1259- #self.scroll_offset = self.scroll_offset - max(-1,(len(old_display_lines_offscreen)-len(display_lines_offscreen)+1) )
1256+ logger . debug ( 'after rewind, self.inconsistent_history is %r' , self . inconsistent_history )
12601257
12611258 self .cursor_offset = 0
12621259 self .current_line = ''
0 commit comments