Skip to content

Instantly share code, notes, and snippets.

@h-east
Last active August 29, 2015 14:24
Show Gist options
  • Save h-east/3243c9167756f25cb663 to your computer and use it in GitHub Desktop.
Save h-east/3243c9167756f25cb663 to your computer and use it in GitHub Desktop.
for Vim 7.4.757 (7.4.761, 7.4.762) later. The OSC can be terminated at the BEL(007) or ST(0x9c).
diff -r 99fc18dc1ede src/term.c
--- a/src/term.c Sun Jun 28 19:24:40 2015 +0200
+++ b/src/term.c Thu Jul 02 12:47:40 2015 +0900
@@ -4264,7 +4264,9 @@
*
* - Background color response:
* <Esc>]11;rgb:{rrrr}/{gggg}/{bbbb}\007
- * The final byte must be '\007'.
+ * Or
+ * <Esc>]11;rgb:{rrrr}/{gggg}/{bbbb}ST
+ * The final byte must be '\007' or ST(0x9c or ESC\).
*/
char_u *argp = tp[0] == CSI ? tp + 1 : tp + 2;
@@ -4408,12 +4410,15 @@
key_name[1] = (int)KE_IGNORE;
slen = i + 1;
}
- else if (*T_RBG != NUL && len >= 24 - (tp[0] == CSI)
+ else if (*T_RBG != NUL
+ && len >= 24 - (tp[0] == CSI)
+ && len >= 24 - (tp[0] == CSI) + (argp[21] == ESC)
&& argp[0] == '1' && argp[1] == '1'
&& argp[2] == ';' && argp[3] == 'r' && argp[4] == 'g'
&& argp[5] == 'b' && argp[6] == ':'
&& argp[11] == '/' && argp[16] == '/'
- && argp[21] == '\007')
+ && (argp[21] == '\007' || argp[21] == STERM
+ || (argp[21] == ESC && argp[22] == '\\')))
{
LOG_TR("Received RBG");
rbg_status = RBG_GOT;
@@ -4427,7 +4432,7 @@
}
key_name[0] = (int)KS_EXTRA;
key_name[1] = (int)KE_IGNORE;
- slen = 24;
+ slen = 24 - (tp[0] == CSI) + (argp[21] == ESC);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment