0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.1464: only 4-digit rgb termresponse is recognized

Problem:    Only 4-digit rgb termresponse is recognized.
Solution:   Also recognize 2-digit rgb response. (closes #4486)
This commit is contained in:
Bram Moolenaar 2019-06-04 21:41:28 +02:00
parent 277e79adc4
commit cea254f5a7
2 changed files with 13 additions and 5 deletions

View File

@ -4962,6 +4962,7 @@ check_termcode(
/* Check for fore/background color response from the terminal: /* Check for fore/background color response from the terminal:
* *
* {lead}{code};rgb:{rrrr}/{gggg}/{bbbb}{tail} * {lead}{code};rgb:{rrrr}/{gggg}/{bbbb}{tail}
* or {lead}{code};rgb:{rr}/{gg}/{bb}{tail}
* *
* {code} is 10 for foreground, 11 for background * {code} is 10 for foreground, 11 for background
* {lead} can be <Esc>] or OSC * {lead} can be <Esc>] or OSC
@ -4985,14 +4986,19 @@ check_termcode(
: (tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\'))) : (tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\')))
{ {
int is_bg = argp[1] == '1'; int is_bg = argp[1] == '1';
int is_4digit = i - j >= 21 && tp[j + 11] == '/'
&& tp[j + 16] == '/';
if (i - j >= 21 && STRNCMP(tp + j + 3, "rgb:", 4) == 0 if (i - j >= 14 && STRNCMP(tp + j + 3, "rgb:", 4) == 0
&& tp[j + 11] == '/' && tp[j + 16] == '/') && (is_4digit
|| (tp[j + 9] == '/' && tp[i + 12 == '/'])))
{ {
# ifdef FEAT_TERMINAL # ifdef FEAT_TERMINAL
int rval = hexhex2nr(tp + j + 7); int rval, gval, bval;
int gval = hexhex2nr(tp + j + 12);
int bval = hexhex2nr(tp + j + 17); rval = hexhex2nr(tp + j + 7);
gval = hexhex2nr(tp + j + (is_4digit ? 12 : 10));
bval = hexhex2nr(tp + j + (is_4digit ? 17 : 13));
# endif # endif
if (is_bg) if (is_bg)
{ {

View File

@ -767,6 +767,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1464,
/**/ /**/
1463, 1463,
/**/ /**/