diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-17 07:28:16 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-25 09:47:28 +0800 |
commit | eb77122823f35c2296cc332aec7f4380db6dafe7 (patch) | |
tree | eb7baf2dee159b46833499d0a49eadf8919f7a42 /src | |
parent | 46e3e1c7280a409462cceb520fe12259b5ba9937 (diff) | |
download | rneovim-eb77122823f35c2296cc332aec7f4380db6dafe7.tar.gz rneovim-eb77122823f35c2296cc332aec7f4380db6dafe7.tar.bz2 rneovim-eb77122823f35c2296cc332aec7f4380db6dafe7.zip |
fix(input): do no reinterpret mouse keys with ALT modifiers
Remove check for MOD_MASK_META as it is for <T- which never appears in TUI.
Make small changes to docs.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/getchar.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 3e8591b2be..4a5841ca6e 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -30,6 +30,7 @@ #include "nvim/memline.h" #include "nvim/memory.h" #include "nvim/message.h" +#include "nvim/mouse.h" #include "nvim/move.h" #include "nvim/normal.h" #include "nvim/ops.h" @@ -1584,16 +1585,18 @@ int vgetc(void) vgetc_char = c; } - // If mappings are enabled (i.e., not Ctrl-v) and the user directly typed - // something with a meta- or alt- modifier that was not mapped, interpret - // <M-x> as <Esc>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 (<M-/<A- modifier) that was not mapped, interpret <M-x> as <Esc>x rather + // than as an unbound <M-x> 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; } |