]> granicus.if.org Git - vim/commitdiff
patch 9.0.0802: MS-Windows: cannot map console mouse scroll events v9.0.0802
authorChristopher Plewright <chris@createng.com>
Thu, 20 Oct 2022 12:11:15 +0000 (13:11 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 20 Oct 2022 12:11:15 +0000 (13:11 +0100)
Problem:    MS-Windows: cannot map console mouse scroll events.
Solution:   Change CSI to K_SPECIAL when checking for a mapping. (Christopher
            Plewright, closes #11410)

src/getchar.c
src/os_win32.c
src/version.c

index bbc6d6ec298b226d5798aee91f910324182479ba..3f83b8484b4de5d76b4e7d4136d407490d713d34 100644 (file)
@@ -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;
index 03b3ac03712ac2f60e5597f06f63b33e4245842e..ca1799f13138ca1eb13e07bdf4784b304bf9c195 100644 (file)
@@ -1265,7 +1265,7 @@ decode_mouse_wheel(MOUSE_EVENT_RECORD *pmer)
 #ifdef FEAT_PROP_POPUP
     int lcol = g_xMouse;
     int lrow = g_yMouse;
-    wp = mouse_find_win(&lrow, &lcol, FAIL_POPUP);
+    wp = mouse_find_win(&lrow, &lcol, FIND_POPUP);
     if (wp != NULL && popup_is_popup(wp))
     {
        g_nMouseClick = -1;
index 983fa0c9953badef2b4a2cbd3b7c029c927e3132..34ff382d1f7c5bf807196efd884ede0e4366e8e1 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    802,
 /**/
     801,
 /**/