diff options
author | Julie Pichon <julie.pichon@gmail.com> | 2010-01-30 15:34:59 (GMT) |
---|---|---|
committer | Julie Pichon <julie.pichon@gmail.com> | 2010-04-25 16:14:01 (GMT) |
commit | ca98a02d4858114ac55ba841784e9ce3bc75fe9d (patch) | |
tree | 3bf78da6eba3460e5f2fcb62068a3cbc318073ef /library | |
parent | 0d622e6c2fe08c9d06ac03aa6d28e49b2f66da21 (diff) |
Parse additional output for xterm size reporting (#843)
Diffstat (limited to 'library')
-rw-r--r-- | library/pippy/console.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/library/pippy/console.py b/library/pippy/console.py index 29ef2d5..c185ce9 100644 --- a/library/pippy/console.py +++ b/library/pippy/console.py @@ -26,8 +26,16 @@ def size(): os.write(fd, '\x1B[18t') # write the 'query screen size' command read_to_delimit('\x1b') # parse response. read_to_delimit('[') - rows = int(read_to_delimit(';')) - cols = int(read_to_delimit('t')) + size = read_to_delimit('t') + # Output can be '8;rows;cols' or 'rows;cols' depending on vte version. + # (SL #843) + values = size.split(';') + if len(values) == 3: + rows = int(values[1]) + cols = int(values[2]) + else: + rows = int(values[0]) + cols = int(values[1]) termios.tcsetattr(fd, termios.TCSANOW, oldattr) # reset tty return cols, rows |