comparison src/term.c @ 31279:7e51449ab768 v9.0.0973

patch 9.0.0973: Kitty keyboard protocol key with NumLock not decoded Commit: https://github.com/vim/vim/commit/064fd67e6a0283bb24732146fd20c92b6dbf47bf Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 29 18:32:32 2022 +0000 patch 9.0.0973: Kitty keyboard protocol key with NumLock not decoded Problem: Kitty keyboard protocol key not decoded when it has an unsupported modifier, such as NumLock. Solution: Accept a key with any modifier. (closes #11638)
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Nov 2022 19:45:03 +0100
parents 68d13970fe8b
children cab7d8accab7
comparison
equal deleted inserted replaced
31278:177a5e6eabde 31279:7e51449ab768
4691 modifiers |= MOD_MASK_ALT; 4691 modifiers |= MOD_MASK_ALT;
4692 if (code & 4) 4692 if (code & 4)
4693 modifiers |= MOD_MASK_CTRL; 4693 modifiers |= MOD_MASK_CTRL;
4694 if (code & 8) 4694 if (code & 8)
4695 modifiers |= MOD_MASK_META; 4695 modifiers |= MOD_MASK_META;
4696 // Any further modifiers are silently dropped.
4697
4696 return modifiers; 4698 return modifiers;
4697 } 4699 }
4698 4700
4699 static int 4701 static int
4700 modifiers2keycode(int modifiers, int *key, char_u *string) 4702 modifiers2keycode(int modifiers, int *key, char_u *string)
5315 #endif 5317 #endif
5316 5318
5317 // Key with modifier: 5319 // Key with modifier:
5318 // {lead}27;{modifier};{key}~ 5320 // {lead}27;{modifier};{key}~
5319 // {lead}{key};{modifier}u 5321 // {lead}{key};{modifier}u
5320 // Only handles four modifiers, this won't work if the modifier value is 5322 // Even though we only handle four modifiers and the {modifier} value
5321 // more than 16. 5323 // should be 16 or lower, we accept all modifier values to avoid the raw
5322 else if (((arg[0] == 27 && argc == 3 && trail == '~') 5324 // sequence to be passed through.
5325 else if ((arg[0] == 27 && argc == 3 && trail == '~')
5323 || (argc == 2 && trail == 'u')) 5326 || (argc == 2 && trail == 'u'))
5324 && arg[1] <= 16)
5325 { 5327 {
5326 return len + handle_key_with_modifier(arg, trail, 5328 return len + handle_key_with_modifier(arg, trail,
5327 csi_len, offset, buf, bufsize, buflen); 5329 csi_len, offset, buf, bufsize, buflen);
5328 } 5330 }
5329 5331
5330 // Key without modifier (Kitty sends this for Esc): 5332 // Key without modifier (Kitty sends this for Esc):
5331 // {lead}{key}u 5333 // {lead}{key}u
5332 else if (argc == 1 && trail == 'u') 5334 else if (argc == 1 && trail == 'u')