@@ -1252,14 +1252,20 @@ def current_output_line(self, value):
12521252 self .current_stdouterr_line = ''
12531253 self .stdin .current_line = '\n '
12541254
1255- def paint (self , about_to_exit = False , user_quit = False ):
1255+ def paint (self , about_to_exit = False , user_quit = False ,
1256+ try_preserve_history_height = 40 ,
1257+ min_infobox_height = 4 ):
12561258 """Returns an array of min_height or more rows and width columns, plus
12571259 cursor position
12581260
12591261 Paints the entire screen - ideally the terminal display layer will take
12601262 a diff and only write to the screen in portions that have changed, but
12611263 the idea is that we don't need to worry about that here, instead every
12621264 frame is completely redrawn because less state is cool!
1265+
1266+ try_preserve_history_height is the the number of rows of content that
1267+ must be visible before the suggestion box scrolls the terminal in order
1268+ to display more than min_infobox_height rows of suggestions, docs etc.
12631269 """
12641270 # The hairiest function in the curtsies
12651271 if about_to_exit :
@@ -1413,15 +1419,12 @@ def move_screen_up(current_line_start_row):
14131419 else :
14141420 # Logic for determining size of completion box
14151421 # smallest allowed over-full completion box
1416- minimum_possible_height = 4
1417- # smallest amount of history that must be visible
1418- try_preserve_history_height = 40
14191422 preferred_height = max (
14201423 # always make infobox at least this height
1421- minimum_possible_height ,
1424+ min_infobox_height ,
14221425
1423- # there's so much space that we can preserve
1424- # this much history and still expand the infobox
1426+ # use this value if there's so much space that we can
1427+ # preserve this try_preserve_history_height rows history
14251428 min_height - try_preserve_history_height )
14261429
14271430 info_max_rows = min (max (visible_space_below ,
0 commit comments