@@ -152,6 +152,7 @@ def __init__(self):
152152 self .stdin = FakeStdin (self .on_finish_running_code )
153153
154154 self .paste_mode = False
155+ self .request_paint_to_clear_screen = False
155156
156157 self .width = None # will both be set by a window resize event
157158 self .height = None
@@ -230,7 +231,7 @@ def process_event(self, e):
230231 raise NotImplementedError ()
231232
232233 elif e in key_dispatch [self .config .clear_screen_key ]: #TODO
233- raise NotImplementedError ()
234+ self . request_paint_to_clear_screen = True
234235 elif e in key_dispatch [self .config .last_output_key ]: #TODO
235236 raise NotImplementedError ()
236237 elif e in key_dispatch [self .config .show_source_key ]: #TODO
@@ -520,8 +521,14 @@ def paint(self, about_to_exit=False):
520521 show_status_bar = bool (self .status_bar .current_line )
521522 if show_status_bar :
522523 min_height -= 1
523- arr = FSArray ( 0 , width )
524+
524525 current_line_start_row = len (self .lines_for_display ) - max (0 , self .scroll_offset )
526+ if self .request_paint_to_clear_screen :
527+ self .request_paint_to_clear_screen = False
528+ arr = FSArray (self .height - 1 + current_line_start_row , width )
529+ else :
530+ arr = FSArray (0 , width )
531+ #TODO test case of current line filling up the whole screen (there aren't enough rows to show it)
525532
526533 if current_line_start_row < 0 : #if current line trying to be drawn off the top of the screen
527534 #assert True, 'no room for current line: contiguity of history broken!'
@@ -580,6 +587,7 @@ def paint(self, about_to_exit=False):
580587
581588 ## Debugging shims
582589 def dumb_print_output (self ):
590+ #TODO this currently doesn't work due to thread control passing issues
583591 arr , cpos = self .paint ()
584592 arr [cpos [0 ], cpos [1 ]] = '~'
585593 def my_print (msg ):
0 commit comments