summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Deutsch <fabiand@fedoraproject.org>2014-01-04 22:00:19 -0500
committerIan Ward <ian@excess.org>2014-01-04 22:00:19 -0500
commit87f9b9e71e89d4097187f9680230374da16a64a4 (patch)
treefde63205a7a74f4c4ff78c15d13bcc9c1102b7f8
parent82effcc488115aebade5669d2d1bdfc29197daa4 (diff)
downloadurwid-87f9b9e71e89d4097187f9680230374da16a64a4.tar.gz
fix #42: raw_display Fallback to 80x24 for term size
-rw-r--r--urwid/raw_display.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/urwid/raw_display.py b/urwid/raw_display.py
index 553445c..1706078 100644
--- a/urwid/raw_display.py
+++ b/urwid/raw_display.py
@@ -568,8 +568,14 @@ class Screen(BaseScreen, RealTerminal):
def get_cols_rows(self):
"""Return the terminal dimensions (num columns, num rows)."""
- buf = fcntl.ioctl(0, termios.TIOCGWINSZ, ' '*4)
- y, x = struct.unpack('hh', buf)
+ y, x = 80, 24
+ try:
+ buf = fcntl.ioctl(self._term_output_file.fileno(),
+ termios.TIOCGWINSZ, ' '*4)
+ y, x = struct.unpack('hh', buf)
+ except IOError:
+ # Term size could not be determined
+ pass
self.maxrow = y
return x, y