From eb77122823f35c2296cc332aec7f4380db6dafe7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 17 Jun 2022 07:28:16 +0800 Subject: fix(input): do no reinterpret mouse keys with ALT modifiers Remove check for MOD_MASK_META as it is for as x rather than as an unbound meta keypress. #8213 - // In Terminal mode, however, this is not desirable. #16220 - if (!no_mapping && KeyTyped && !(State & MODE_TERMINAL) - && (mod_mask == MOD_MASK_ALT || mod_mask == MOD_MASK_META)) { + // If mappings are enabled (i.e., not i_CTRL-V) and the user directly typed something with + // MOD_MASK_ALT ( as x rather + // than as an unbound keypress. #8213 + // In Terminal mode, however, this is not desirable. #16202 #16220 + // Also do not do this for mouse keys, as terminals encode mouse events as CSI sequences, and + // MOD_MASK_ALT has a meaning even for unmapped mouse keys. + if (!no_mapping && KeyTyped && mod_mask == MOD_MASK_ALT && !(State & MODE_TERMINAL) + && !is_mouse_key(c)) { mod_mask = 0; int len = ins_char_typebuf(c, 0); (void)ins_char_typebuf(ESC, 0); - ungetchars(len + 3); // The ALT/META modifier takes three more bytes + ungetchars(len + 3); // K_SPECIAL KS_MODIFIER MOD_MASK_ALT takes 3 more bytes continue; } -- cgit