@@ -263,7 +263,6 @@ def process_event(self, e):
263263 self .run_code_and_maybe_finish ()
264264 elif isinstance (e , events .WindowChangeEvent ):
265265 logging .debug ('window change to %d %d' , e .width , e .height )
266- #TODO when window gets larger, history is eaten up
267266 self .scroll_offset -= e .cursor_dy
268267 self .width , self .height = e .width , e .height
269268
@@ -554,7 +553,7 @@ def unhighlight_paren(self):
554553 logging .debug ('trying to unhighlight a paren on line %r' , lineno )
555554 logging .debug ('with these tokens: %r' , saved_tokens )
556555 new = bpythonparse (format (saved_tokens , self .formatter ))
557- self .display_buffer [lineno ] = self .display_buffer [lineno ].setslice (0 , len (new ), new )
556+ self .display_buffer [lineno ] = self .display_buffer [lineno ].setslice_with_length (0 , len (new ), new , len ( self . display_buffer [ lineno ]) )
558557
559558 def clear_current_block (self , remove_from_history = True ):
560559 self .display_buffer = []
@@ -691,17 +690,6 @@ def current_output_line(self, value):
691690 def paint (self , about_to_exit = False , user_quit = False ):
692691 """Returns an array of min_height or more rows and width columns, plus cursor position
693692
694- Also increments self.scroll_offset by the amount the terminal must have scrolled
695- to display the entire array.
696- """
697- arr , (row , col ) = self ._paint (about_to_exit = about_to_exit , user_quit = user_quit )
698- if arr .height > self .height :
699- self .scroll_offset += arr .height - self .height
700- return arr , (row , col )
701-
702- def _paint (self , about_to_exit = False , user_quit = False ):
703- """Returns an array of min_height or more rows and width columns, plus cursor position
704-
705693 Paints the entire screen - ideally the terminal display layer will take a diff and only
706694 write to the screen in portions that have changed, but the idea is that we don't need
707695 to worry about that here, instead every frame is completely redrawn because
@@ -717,7 +705,6 @@ def _paint(self, about_to_exit=False, user_quit=False):
717705 if show_status_bar :
718706 min_height -= 1
719707
720-
721708 current_line_start_row = len (self .lines_for_display ) - max (0 , self .scroll_offset )
722709 if self .request_paint_to_clear_screen : # or show_status_bar and about_to_exit ?
723710 self .request_paint_to_clear_screen = False
0 commit comments