Skip to content

Commit 9707810

Browse files
correct layout for short terminals
1 parent cb7e36e commit 9707810

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,7 @@ def move_screen_up(current_line_start_row):
13751375
lines = paint.display_linize(self.current_cursor_line + 'X', width)
13761376
# extra character for space for the cursor
13771377
current_line_end_row = current_line_start_row + len(lines) - 1
1378+
current_line_height = current_line_end_row - current_line_start_row
13781379

13791380
if self.stdin.has_focus:
13801381
cursor_row, cursor_column = divmod(
@@ -1410,9 +1411,10 @@ def move_screen_up(current_line_start_row):
14101411
info_max_rows = max(visible_space_above, visible_space_below)
14111412
else:
14121413
# smallest allowed over-full completion box
1413-
minimum_possible_height = 30
1414-
info_max_rows = max(visible_space_below,
1415-
minimum_possible_height)
1414+
minimum_possible_height = 20
1415+
info_max_rows = min(max(visible_space_below,
1416+
minimum_possible_height),
1417+
min_height - current_line_height - 1)
14161418
infobox = paint.paint_infobox(
14171419
info_max_rows,
14181420
int(width * self.config.cli_suggestion_width),

0 commit comments

Comments
 (0)