Skip to content

Commit

Permalink
fallback for incorrectly reported terminal size
Browse files Browse the repository at this point in the history
add back fallback fix from 9ad1dd9 that got lost in the refactor 6970fbd
  • Loading branch information
davidszotten authored and jonathanslenders committed Apr 14, 2019
1 parent 37dcf63 commit f66f74e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions prompt_toolkit/output/vt100.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,14 @@ def from_pty(cls, stdout, term=None):
cls._fds_not_a_terminal.add(fd)

def get_size():
# If terminal (incorrectly) reports its size as 0, pick a
# reasonable default. See
# https://github.com/ipython/ipython/issues/10071
rows, columns = (None, None)

if isatty:
rows, columns = _get_size(stdout.fileno())
return Size(rows=rows, columns=columns)
else:
return Size(rows=24, columns=80)
return Size(rows=rows or 24, columns=columns or 80)

return cls(stdout, get_size, term=term)

Expand Down

0 comments on commit f66f74e

Please sign in to comment.