Handle CSI codes that start with a ;

This commit is contained in:
Kovid Goyal 2016-11-30 16:03:45 +05:30
parent a095fffc67
commit 45a5190a0d
2 changed files with 2 additions and 0 deletions

View File

@ -356,6 +356,7 @@ dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) {
break;
default:
if (i > start) params[num_params++] = utoi(buf + start, i - start);
else if (i == start && buf[i] == ';') params[num_params++] = 0;
if (num_params >= MAX_PARAMS) { i = num; start = num + 1; }
start = i + 1;
break;

View File

@ -108,6 +108,7 @@ class TestParser(BaseTest):
pb('\033[38;2;1;2;3;48;2;7;8;9m', ('select_graphic_rendition', '38 2 1 2 3 48 2 7 8 9 '))
self.ae(s.cursor.fg, 1 << 24 | 2 << 16 | 3 << 8 | 2)
self.ae(s.cursor.bg, 7 << 24 | 8 << 16 | 9 << 8 | 2)
pb('\033[;2m', ('select_graphic_rendition', '0 2 '))
c = s.callbacks
pb('\033[5n', ('report_device_status', 5, 0))
self.ae(c.wtcbuf, b'\033[0n')