summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorChristopher Plewright <chris@createng.com>2022-11-22 12:58:27 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-22 12:58:27 +0000
commit0319306f20d2a5989d1f5639a47d77cebeac2f29 (patch)
treef68699815c966afae4f3f45ca4ec1d5805e5a314 /src/getchar.c
parent35fc61cb5b5eba8bbb9d8f0700332fbab38f40ca (diff)
patch 9.0.0918: MS-Windows: modifier keys do not work with mouse scroll eventv9.0.0918
Problem: MS-Windows: modifier keys do not work with mouse scroll events. Solution: Use K_SPECIAL instead of CSI for the modifier keys. (Christopher Plewright, closes #11587)
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 2fa68a789f..e2474be0b1 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1743,11 +1743,9 @@ vgetc(void)
--allow_keys;
}
- // Get two extra bytes for special keys
+ // Get two extra bytes for special keys, handle modifiers.
if (c == K_SPECIAL
-#if defined(FEAT_GUI) || defined(MSWIN)
- // GUI codes start with CSI; MS-Windows sends mouse scroll
- // events with CSI.
+#ifdef FEAT_GUI
|| c == CSI
#endif
)
@@ -2520,32 +2518,12 @@ handle_mapping(
&& State != MODE_CONFIRM
&& !at_ins_compl_key())
{
-#if defined(FEAT_GUI) || defined(MSWIN)
- if (tb_c1 == CSI
-# if !defined(MSWIN)
- && gui.in_use
-# endif
- && typebuf.tb_len >= 2
- && (typebuf.tb_buf[typebuf.tb_off + 1] == KS_MODIFIER
-# if defined(MSWIN)
- || (typebuf.tb_len >= 3
-# ifdef FEAT_GUI
- && !gui.in_use
-# endif
- && typebuf.tb_buf[typebuf.tb_off + 1] == KS_EXTRA
- && (typebuf.tb_buf[typebuf.tb_off + 2] == KE_MOUSEUP
- || typebuf.tb_buf[typebuf.tb_off + 2] == KE_MOUSEDOWN
- || typebuf.tb_buf[typebuf.tb_off + 2] == KE_MOUSELEFT
- || typebuf.tb_buf[typebuf.tb_off + 2] == KE_MOUSERIGHT)
- )
-# endif
- )
- )
+#ifdef FEAT_GUI
+ if (gui.in_use && tb_c1 == CSI && typebuf.tb_len >= 2
+ && typebuf.tb_buf[typebuf.tb_off + 1] == KS_MODIFIER)
{
// The GUI code sends CSI KS_MODIFIER {flags}, but mappings expect
// K_SPECIAL KS_MODIFIER {flags}.
- // MS-Windows sends mouse scroll events CSI KS_EXTRA {what}, but
- // non-GUI mappings expect K_SPECIAL KS_EXTRA {what}.
tb_c1 = K_SPECIAL;
}
#endif