mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-10 14:14:48 +02:00
Improve error reporting of incomplete SGR codes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user