From 3cb74a25ba04c89e3785b5cf744f620e4fe27616 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 5 Nov 2017 10:06:33 +0530 Subject: [PATCH] Fix handling of empty SGR code Was broken by refactoring to support colons in SGR codes --- kitty/parser.c | 4 ++++ kitty_tests/parser.py | 1 + 2 files changed, 5 insertions(+) diff --git a/kitty/parser.c b/kitty/parser.c index 79986e599..bccd849e6 100644 --- a/kitty/parser.c +++ b/kitty/parser.c @@ -482,6 +482,10 @@ parse_sgr(Screen *screen, uint32_t *buf, unsigned int num, unsigned int *params, } } switch(state) { + case START: + params[num_params++] = 0; + SEND_SGR; + break; case COLOR1: case COLOR3: case NORMAL: diff --git a/kitty_tests/parser.py b/kitty_tests/parser.py index de7ffcb58..0cb907641 100644 --- a/kitty_tests/parser.py +++ b/kitty_tests/parser.py @@ -133,6 +133,7 @@ class TestParser(BaseTest): self.ae(s.cursor.bg, 7 << 24 | 8 << 16 | 9 << 8 | 2) pb('\033[0;2m', *sgr('0 2')) pb('\033[;2m', *sgr('0 2')) + pb('\033[m', *sgr('0 ')) pb('\033[1;;2m', *sgr('1 0 2')) pb('\033[38;5;1m', ('select_graphic_rendition', '38 5 1 ')) pb('\033[38;2;1;2;3m', ('select_graphic_rendition', '38 2 1 2 3 '))