comparison 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
comparison
equal deleted inserted replaced
31136:9423dacd1538 31137:548241980a27
5242 * 5242 *
5243 * {lead} can be <Esc>P or DCS 5243 * {lead} can be <Esc>P or DCS
5244 * {flag} can be '0' or '1' 5244 * {flag} can be '0' or '1'
5245 * {tail} can be Esc>\ or STERM 5245 * {tail} can be Esc>\ or STERM
5246 * 5246 *
5247 * Check for resource response from xterm (and drop it):
5248 * {lead}{flag}+R<hex bytes>=<value>{tail}
5249 *
5247 * Check for cursor shape response from xterm: 5250 * Check for cursor shape response from xterm:
5248 * {lead}1$r<digit> q{tail} 5251 * {lead}1$r<digit> q{tail}
5249 * 5252 *
5250 * {lead} can be <Esc>P or DCS 5253 * {lead} can be <Esc>P or DCS
5251 * {tail} can be <Esc>\ or STERM 5254 * {tail} can be <Esc>\ or STERM
5258 int i, j; 5261 int i, j;
5259 5262
5260 j = 1 + (tp[0] == ESC); 5263 j = 1 + (tp[0] == ESC);
5261 if (len < j + 3) 5264 if (len < j + 3)
5262 i = len; // need more chars 5265 i = len; // need more chars
5263 else if ((argp[1] != '+' && argp[1] != '$') || argp[2] != 'r') 5266 else if ((argp[1] != '+' && argp[1] != '$')
5267 || (argp[2] != 'r' && argp[2] != 'R'))
5264 i = 0; // no match 5268 i = 0; // no match
5265 else if (argp[1] == '+') 5269 else if (argp[1] == '+')
5266 // key code response 5270 // key code response
5267 for (i = j; i < len; ++i) 5271 for (i = j; i < len; ++i)
5268 { 5272 {
5269 if ((tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\') 5273 if ((tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\')
5270 || tp[i] == STERM) 5274 || tp[i] == STERM)
5271 { 5275 {
5272 if (i - j >= 3) 5276 // handle a key code response, drop a resource response
5277 if (i - j >= 3 && argp[2] == 'r')
5273 got_code_from_term(tp + j, i); 5278 got_code_from_term(tp + j, i);
5274 key_name[0] = (int)KS_EXTRA; 5279 key_name[0] = (int)KS_EXTRA;
5275 key_name[1] = (int)KE_IGNORE; 5280 key_name[1] = (int)KE_IGNORE;
5276 *slen = i + 1 + (tp[i] == ESC); 5281 *slen = i + 1 + (tp[i] == ESC);
5277 break; 5282 break;
5672 return -1; 5677 return -1;
5673 } 5678 }
5674 5679
5675 // Check for key code response from xterm, 5680 // Check for key code response from xterm,
5676 // starting with <Esc>P or DCS 5681 // starting with <Esc>P or DCS
5677 else if ((check_for_codes || rcs_status.tr_progress == STATUS_SENT) 5682 // It would only be needed with this condition:
5678 && ((tp[0] == ESC && len >= 2 && tp[1] == 'P') 5683 // (check_for_codes || rcs_status.tr_progress == STATUS_SENT)
5679 || tp[0] == DCS)) 5684 // Now this is always done so that DCS codes don't mess up things.
5685 else if ((tp[0] == ESC && len >= 2 && tp[1] == 'P') || tp[0] == DCS)
5680 { 5686 {
5681 if (handle_dcs(tp, argp, len, key_name, &slen) == FAIL) 5687 if (handle_dcs(tp, argp, len, key_name, &slen) == FAIL)
5682 return -1; 5688 return -1;
5683 } 5689 }
5684 } 5690 }