summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorChristopher Plewright <chris@createng.com>2022-10-20 13:11:15 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-20 13:11:15 +0100
commit4c36678ffd1f933a6d4a12415994dea15e4ccec6 (patch)
tree9006e03edaa19e6ad8c46e14910fa04ac6075549 /src/getchar.c
parent7609c88eedc113bc80ccf74050b03a2e0c1a3c5e (diff)
patch 9.0.0802: MS-Windows: cannot map console mouse scroll eventsv9.0.0802
Problem: MS-Windows: cannot map console mouse scroll events. Solution: Change CSI to K_SPECIAL when checking for a mapping. (Christopher Plewright, closes #11410)
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/getchar.c b/src/getchar.c
index bbc6d6ec29..3f83b8484b 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2520,12 +2520,29 @@ handle_mapping(
&& State != MODE_CONFIRM
&& !at_ins_compl_key())
{
-#ifdef FEAT_GUI
- if (gui.in_use && tb_c1 == CSI && typebuf.tb_len >= 2
- && typebuf.tb_buf[typebuf.tb_off + 1] == KS_MODIFIER)
+#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
+ && 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
+ )
+ )
{
// 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
+ // mappings expect K_SPECIAL KS_EXTRA {what}.
tb_c1 = K_SPECIAL;
}
#endif
@@ -2568,7 +2585,8 @@ handle_mapping(
&& (mp->m_mode & local_State)
&& !(mp->m_simplified && seenModifyOtherKeys
&& typebuf.tb_maplen == 0)
- && ((mp->m_mode & MODE_LANGMAP) == 0 || typebuf.tb_maplen == 0))
+ && ((mp->m_mode & MODE_LANGMAP) == 0
+ || typebuf.tb_maplen == 0))
{
#ifdef FEAT_LANGMAP
int nomap = nolmaplen;