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')