summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS6
-rw-r--r--ttystatus/tty.py8
2 files changed, 12 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 259dc88..a0c5e0c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,12 @@
NEWS file for ttystatus
=======================
+Version 0.28, released 2015-10-10
+---------------------------------
+
+* Fix another case where terminal capabilities are queried and the
+ terminal isn't capable.
+
Version 0.27, released 2015-10-10
---------------------------------
diff --git a/ttystatus/tty.py b/ttystatus/tty.py
index 580401b..31a9036 100644
--- a/ttystatus/tty.py
+++ b/ttystatus/tty.py
@@ -34,8 +34,12 @@ class PhysicalTerminal(object):
def open_tty(self):
self._terminal = open('/dev/tty', 'wb')
curses.setupterm(None, self._terminal.fileno())
- self._cuu = curses.tparm(curses.tigetstr('cuu'), 1)
- self._cud = curses.tparm(curses.tigetstr('cud'), 1)
+
+ for name in ['cuu', 'cud']:
+ s = curses.tigetstr(name)
+ if s is not None:
+ setattr(self, '_' + name, curses.tparm(s, 1))
+
self._cr = curses.tigetstr('cr')
self._el = curses.tigetstr('el')