]> granicus.if.org Git - vim/commitdiff
patch 8.1.1464: only 4-digit rgb termresponse is recognized v8.1.1464
authorBram Moolenaar <Bram@vim.org>
Tue, 4 Jun 2019 19:41:28 +0000 (21:41 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 4 Jun 2019 19:41:28 +0000 (21:41 +0200)
Problem:    Only 4-digit rgb termresponse is recognized.
Solution:   Also recognize 2-digit rgb response. (closes #4486)

src/term.c
src/version.c

index cd0e7d31ea2749dba933be73b6678108862ba893..bcd2184f4fb58880c5ad74b1640cec5e5525edb4 100644 (file)
@@ -4962,6 +4962,7 @@ check_termcode(
            /* Check for fore/background color response from the terminal:
             *
             *       {lead}{code};rgb:{rrrr}/{gggg}/{bbbb}{tail}
+            * or    {lead}{code};rgb:{rr}/{gg}/{bb}{tail}
             *
             * {code} is 10 for foreground, 11 for background
             * {lead} can be <Esc>] or OSC
@@ -4985,14 +4986,19 @@ check_termcode(
                        : (tp[i] == ESC && i + 1 < len && tp[i + 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
-                           && tp[j + 11] == '/' && tp[j + 16] == '/')
+                       if (i - j >= 14 && STRNCMP(tp + j + 3, "rgb:", 4) == 0
+                           && (is_4digit
+                                  || (tp[j + 9] == '/' && tp[i + 12 == '/'])))
                        {
 # ifdef FEAT_TERMINAL
-                           int rval = hexhex2nr(tp + j + 7);
-                           int gval = hexhex2nr(tp + j + 12);
-                           int bval = hexhex2nr(tp + j + 17);
+                           int rval, gval, bval;
+
+                           rval = hexhex2nr(tp + j + 7);
+                           gval = hexhex2nr(tp + j + (is_4digit ? 12 : 10));
+                           bval = hexhex2nr(tp + j + (is_4digit ? 17 : 13));
 # endif
                            if (is_bg)
                            {
index 7d86aaeb467894c02ef3224144c7fd86b319b9ba..57f6db3911b6e48717c4c521f790c04512f03ccf 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1464,
 /**/
     1463,
 /**/