Skip to content

Commit cbe87c9

Browse files
choose completion box size based on screen size
1 parent a97b8ab commit cbe87c9

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,10 +1411,21 @@ def move_screen_up(current_line_start_row):
14111411
if self.config.curtsies_list_above:
14121412
info_max_rows = max(visible_space_above, visible_space_below)
14131413
else:
1414+
# Logic for determining size of completion box
14141415
# smallest allowed over-full completion box
1415-
minimum_possible_height = 20
1416+
minimum_possible_height = 4
1417+
# smallest amount of history that must be visible
1418+
try_preserve_history_height = 40
1419+
preferred_height = max(
1420+
# always make infobox at least this height
1421+
minimum_possible_height,
1422+
1423+
# there's so much space that we can preserve
1424+
# this much history and still expand the infobox
1425+
min_height - try_preserve_history_height)
1426+
14161427
info_max_rows = min(max(visible_space_below,
1417-
minimum_possible_height),
1428+
preferred_height),
14181429
min_height - current_line_height - 1)
14191430
infobox = paint.paint_infobox(
14201431
info_max_rows,

0 commit comments

Comments
 (0)