To: vim_dev@googlegroups.com Subject: Patch 8.1.1464 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1464 Problem: Only 4-digit rgb termresponse is recognized. Solution: Also recognize 2-digit rgb response. (closes #4486) Files: src/term.c, src/test_termcodes.vim *** ../vim-8.1.1463/src/term.c 2019-05-28 23:08:12.080648632 +0200 --- src/term.c 2019-06-04 21:23:11.508570961 +0200 *************** *** 4962,4967 **** --- 4962,4968 ---- /* 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 ] or OSC *************** *** 4985,4998 **** : (tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\'))) { int is_bg = argp[1] == '1'; ! if (i - j >= 21 && STRNCMP(tp + j + 3, "rgb:", 4) == 0 ! && tp[j + 11] == '/' && tp[j + 16] == '/') { # ifdef FEAT_TERMINAL ! int rval = hexhex2nr(tp + j + 7); ! int gval = hexhex2nr(tp + j + 12); ! int bval = hexhex2nr(tp + j + 17); # endif if (is_bg) { --- 4986,5004 ---- : (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 >= 14 && STRNCMP(tp + j + 3, "rgb:", 4) == 0 ! && (is_4digit ! || (tp[j + 9] == '/' && tp[i + 12 == '/']))) { # ifdef FEAT_TERMINAL ! 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) { *** ../vim-8.1.1463/src/version.c 2019-06-04 19:16:25.518124894 +0200 --- src/version.c 2019-06-04 21:39:56.729716125 +0200 *************** *** 769,770 **** --- 769,772 ---- { /* Add new patch number below this line */ + /**/ + 1464, /**/ -- From "know your smileys": +<(:-) The Pope /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///