diff options
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | ttystatus/tty.py | 8 |
2 files changed, 12 insertions, 2 deletions
@@ -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') |