Skip to content

Commit f66f74e

Browse files
davidszottenjonathanslenders
authored andcommitted
fallback for incorrectly reported terminal size
add back fallback fix from 9ad1dd9 that got lost in the refactor 6970fbd
1 parent 37dcf63 commit f66f74e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

prompt_toolkit/output/vt100.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,14 @@ def from_pty(cls, stdout, term=None):
425425
cls._fds_not_a_terminal.add(fd)
426426

427427
def get_size():
428+
# If terminal (incorrectly) reports its size as 0, pick a
429+
# reasonable default. See
430+
# https://github.com/ipython/ipython/issues/10071
431+
rows, columns = (None, None)
432+
428433
if isatty:
429434
rows, columns = _get_size(stdout.fileno())
430-
return Size(rows=rows, columns=columns)
431-
else:
432-
return Size(rows=24, columns=80)
435+
return Size(rows=rows or 24, columns=columns or 80)
433436

434437
return cls(stdout, get_size, term=term)
435438

0 commit comments

Comments
 (0)