@@ -298,7 +298,7 @@ def process_event(self, e):
298298 t .start ()
299299 self .interact .wait_for_request_or_notify ()
300300 elif e in key_dispatch [EDITOR_KEY ]:
301- self .external_editor ()
301+ self .send_to_external_editor ()
302302 #TODO add PAD keys hack as in bpython.cli
303303 else :
304304 self .add_normal_character (e if len (e ) == 1 else e [- 1 ]) #strip control seq
@@ -601,19 +601,21 @@ def paint(self, about_to_exit=False):
601601 cursor_column = (self .cursor_offset_in_line + len (self .display_line_with_prompt ) - len (self ._current_line )) % width
602602
603603 if self .list_win_visible :
604- #TODO infobox not properly expanding window! try reduce( docs about halfway down a 80x24 terminal
604+ #infobox not properly expanding window! try reduce( docs about halfway down a 80x24 terminal
605+ #TODO what's the desired behavior here? Currently uses only the space already on screen,
606+ # scrolling down only if there would have been more space above the current line, but being forced to put below
605607 logging .debug ('infobox display code running' )
606608 visible_space_above = history .height
607- visible_space_below = min_height - cursor_row
608- info_max_rows = max (visible_space_above , visible_space_below )
609+ visible_space_below = min_height - cursor_row - 1
609610
611+ info_max_rows = max (visible_space_above , visible_space_below )
610612 infobox = paint .paint_infobox (info_max_rows , int (width * self .config .cli_suggestion_width ), self .matches , self .argspec , self .current_word , self .docstring , self .config )
611613
612614 if visible_space_above >= infobox .height and not INFOBOX_ONLY_BELOW :
613615 arr [current_line_start_row - infobox .height :current_line_start_row , 0 :infobox .width ] = infobox
614616 else :
615617 arr [cursor_row + 1 :cursor_row + 1 + infobox .height , 0 :infobox .width ] = infobox
616- # logging.debug('slamming infobox of shape %r into arr', infobox.shape)
618+ logging .debug ('slamming infobox of shape %r into arr of shape %r ' , infobox . shape , arr .shape )
617619
618620 logging .debug ('about to exit: %r' , about_to_exit )
619621 if show_status_bar :
@@ -732,7 +734,7 @@ def getstdout(self):
732734 s = '\n ' .join ([x .s if isinstance (x , FmtStr ) else x
733735 for x in lines ]) if lines else ''
734736 return s
735- def external_editor (self ):
737+ def send_to_external_editor (self , filename = None ):
736738 editor = os .environ .get ('VISUAL' , os .environ .get ('EDITOR' , 'vim' ))
737739 text = self .getstdout ()
738740 with tempfile .NamedTemporaryFile (suffix = '.py' ) as temp :
0 commit comments