Improve error reporting of incomplete SGR codes
This commit is contained in:
parent
3cb74a25ba
commit
a614fe615f
2 changed files with 15 additions and 4 deletions
|
|
@ -487,13 +487,23 @@ parse_sgr(Screen *screen, uint32_t *buf, unsigned int num, unsigned int *params,
|
|||
SEND_SGR;
|
||||
break;
|
||||
case COLOR1:
|
||||
case COLOR3:
|
||||
case NORMAL:
|
||||
case MULTIPLE:
|
||||
READ_PARAM;
|
||||
SEND_SGR;
|
||||
if (i > num_start) { READ_PARAM; }
|
||||
if (num_params) { SEND_SGR; }
|
||||
else { REPORT_ERROR("Incomplete SGR code"); }
|
||||
break;
|
||||
default:
|
||||
case COLOR:
|
||||
REPORT_ERROR("Invalid SGR code containing incomplete semi-colon separated color sequence");
|
||||
break;
|
||||
case COLOR3:
|
||||
if (i > num_start) READ_PARAM;
|
||||
if (num_params != 5) {
|
||||
REPORT_ERROR("Invalid SGR code containing incomplete semi-colon separated color sequence");
|
||||
break;
|
||||
}
|
||||
if (num_params) { SEND_SGR; }
|
||||
else { REPORT_ERROR("Incomplete SGR code"); }
|
||||
break;
|
||||
}
|
||||
#undef READ_PARAM
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ def sgr(params):
|
|||
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[58;2;1;2;3m', ('select_graphic_rendition', '58 2 1 2 3 '))
|
||||
pb('\033[38;2;1;2;3m', ('select_graphic_rendition', '38 2 1 2 3 '))
|
||||
pb('\033[1001:2:1:2:3m', ('select_graphic_rendition', '1001 2 1 2 3 '))
|
||||
pb('\033[38:2:1:2:3;48:5:9;58;5;7m', (
|
||||
|
|
|
|||
Loading…
Reference in a new issue