From a120b252866859a439b4d0e48d728dbe62676afd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Nov 2016 11:31:48 +0530 Subject: [PATCH] Stub for DCS codes --- kitty/parser.c | 6 +++++- kitty_tests/parser.py | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/kitty/parser.c b/kitty/parser.c index d532123e7..010138033 100644 --- a/kitty/parser.c +++ b/kitty/parser.c @@ -486,7 +486,11 @@ HANDLER(osc) { // Parse DCS {{{ HANDLER(dcs) { - screen->parser_state = NORMAL_STATE; + // http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Device-Control-functions + uint8_t ch = buf[(*pos)++]; + if (ch == ST) { + SET_STATE(NORMAL_STATE); + } } // }}} diff --git a/kitty_tests/parser.py b/kitty_tests/parser.py index 67a6df253..e9d915be8 100644 --- a/kitty_tests/parser.py +++ b/kitty_tests/parser.py @@ -146,3 +146,9 @@ class TestScreen(BaseTest): c.clear() pb('\033]2;;;;\x07', ('set_title', 3)) self.ae(c.titlebuf, b';;;') + + def test_dcs_codes(self): + s = self.create_screen() + pb = partial(self.parse_bytes_dump, s) + pb(b'a\033P2;xyz\x9cbcde') + self.ae(str(s.line(0)), 'abcde')