summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRhett Aultman <roadriverrail@gmail.com>2023-03-31 12:59:55 -0400
committerGitHub <noreply@github.com>2023-03-31 18:59:55 +0200
commit0a5518eb04ee6b22d425dacd2be0897916380c7f (patch)
treecb36820fa6b93a62ffc5905de038e072f175bf5f
parentea7e615ef5ee0897f66210f47ab6390889d7b313 (diff)
downloadurwid-0a5518eb04ee6b22d425dacd2be0897916380c7f.tar.gz
Provide 80x24 fallback for ansi and vt100 (#465)
Not all terminals will necessarily respond to the TIOCGWINSZ ioctl, particularly much older ones providing vt100 or ansi terminals, which will have a fixed 80x24 size. If they respond with some kind of non-sensical value here, then at least give the ansi and vt100 terminals their default so they can draw.
-rw-r--r--urwid/raw_display.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/urwid/raw_display.py b/urwid/raw_display.py
index f24e30b..7d90f3b 100644
--- a/urwid/raw_display.py
+++ b/urwid/raw_display.py
@@ -681,6 +681,10 @@ class Screen(BaseScreen, RealTerminal):
except OSError:
# Term size could not be determined
pass
+ # Provide some lightweight fallbacks in case the TIOCWINSZ doesn't
+ # give sane answers
+ if (x <= 0 or y <= 0) and self.term in ('ansi','vt100'):
+ y, x = 24, 80
self.maxrow = y
return x, y