diff src/term.c @ 31137:548241980a27 v9.0.0903

patch 9.0.0903: key code checker doesn't check modifyOtherKeys resource Commit: https://github.com/vim/vim/commit/236dffab43f919bdbc565e6edc38eb27e7a5b657 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Nov 18 21:20:25 2022 +0000 patch 9.0.0903: key code checker doesn't check modifyOtherKeys resource Problem: Key code checker doesn't check modifyOtherKeys resource. Solution: Request the modifyOtherKeys resource value. Drop resource DCS responses.
author Bram Moolenaar <Bram@vim.org>
date Fri, 18 Nov 2022 22:30:04 +0100
parents 9cc7b2cec8ad
children 25f6c7f77c70
line wrap: on
line diff
--- a/src/term.c
+++ b/src/term.c
@@ -5244,6 +5244,9 @@ handle_osc(char_u *tp, char_u *argp, int
  * {flag} can be '0' or '1'
  * {tail} can be Esc>\ or STERM
  *
+ * Check for resource response from xterm (and drop it):
+ * {lead}{flag}+R<hex bytes>=<value>{tail}
+ *
  * Check for cursor shape response from xterm:
  * {lead}1$r<digit> q{tail}
  *
@@ -5260,7 +5263,8 @@ handle_dcs(char_u *tp, char_u *argp, int
     j = 1 + (tp[0] == ESC);
     if (len < j + 3)
 	i = len; // need more chars
-    else if ((argp[1] != '+' && argp[1] != '$') || argp[2] != 'r')
+    else if ((argp[1] != '+' && argp[1] != '$')
+	    || (argp[2] != 'r' && argp[2] != 'R'))
 	i = 0; // no match
     else if (argp[1] == '+')
 	// key code response
@@ -5269,7 +5273,8 @@ handle_dcs(char_u *tp, char_u *argp, int
 	    if ((tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\')
 		    || tp[i] == STERM)
 	    {
-		if (i - j >= 3)
+		// handle a key code response, drop a resource response
+		if (i - j >= 3 && argp[2] == 'r')
 		    got_code_from_term(tp + j, i);
 		key_name[0] = (int)KS_EXTRA;
 		key_name[1] = (int)KE_IGNORE;
@@ -5674,9 +5679,10 @@ check_termcode(
 
 	    // Check for key code response from xterm,
 	    // starting with <Esc>P or DCS
-	    else if ((check_for_codes || rcs_status.tr_progress == STATUS_SENT)
-		    && ((tp[0] == ESC && len >= 2 && tp[1] == 'P')
-			|| tp[0] == DCS))
+	    // It would only be needed with this condition:
+	    //	    (check_for_codes || rcs_status.tr_progress == STATUS_SENT)
+	    // Now this is always done so that DCS codes don't mess up things.
+	    else if ((tp[0] == ESC && len >= 2 && tp[1] == 'P') || tp[0] == DCS)
 	    {
 		if (handle_dcs(tp, argp, len, key_name, &slen) == FAIL)
 		    return -1;