]> granicus.if.org Git - vim/commitdiff
patch 8.1.1265: when GPM mouse support is enabled double clicks do not work v8.1.1265
authorBram Moolenaar <Bram@vim.org>
Sat, 4 May 2019 14:58:45 +0000 (16:58 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 4 May 2019 14:58:45 +0000 (16:58 +0200)
Problem:    When GPM mouse support is enabled double clicks in xterm do not
            work.
Solution:   Use KS_GPM_MOUSE for GPM mouse events.

src/keymap.h
src/os_unix.c
src/term.c
src/version.c

index d6dd5cbb35f8568ac67284722c48a1eb5a294af8..47294f028833fe1fc658230a858e39e8fbf97a39 100644 (file)
 #define KS_SGR_MOUSE           237
 #define KS_SGR_MOUSE_RELEASE   236
 
+/* Used for the GPM mouse. */
+#define KS_GPM_MOUSE           235
+
 /*
  * Filler used after KS_SPECIAL and others
  */
index ba5d386bb1771294fa1a1657f8d85c6df3857eaa..9f8a7b110ead886a2edee026073580faf62ce2ec 100644 (file)
@@ -3794,7 +3794,10 @@ check_mouse_termcode(void)
            && !gui.in_use
 #  endif
            )
-       set_mouse_termcode(KS_MOUSE, (char_u *)IF_EB("\033MG", ESC_STR "MG"));
+       set_mouse_termcode(KS_GPM_MOUSE,
+                                     (char_u *)IF_EB("\033MG", ESC_STR "MG"));
+    else
+       del_mouse_termcode(KS_GPM_MOUSE);
 # endif
 
 # ifdef FEAT_SYSMOUSE
@@ -7065,7 +7068,8 @@ gpm_close(void)
        Gpm_Close();
 }
 
-/* Reads gpm event and adds special keys to input buf. Returns length of
+/*
+ * Reads gpm event and adds special keys to input buf. Returns length of
  * generated key sequence.
  * This function is styled after gui_send_mouse_event().
  */
index 4a39fe3df75f0cecfc7382b86dfad5b72a42f58c..bcc3dd387233ed23e07903d140f3bb91dc98d41f 100644 (file)
@@ -4396,9 +4396,6 @@ check_termcode(
 # endif
 #endif
     int                cpo_koffset;
-#ifdef FEAT_MOUSE_GPM
-    extern int gpm_flag; /* gpm library variable */
-#endif
 
     cpo_koffset = (vim_strchr(p_cpo, CPO_KOFFSET) != NULL);
 
@@ -5122,6 +5119,9 @@ check_termcode(
         * If it is a mouse click, get the coordinates.
         */
        if (key_name[0] == KS_MOUSE
+# ifdef FEAT_MOUSE_GPM
+               || key_name[0] == KS_GPM_MOUSE
+# endif
 # ifdef FEAT_MOUSE_JSB
                || key_name[0] == KS_JSBTERM_MOUSE
 # endif
@@ -5144,7 +5144,11 @@ check_termcode(
 
 # if !defined(UNIX) || defined(FEAT_MOUSE_XTERM) || defined(FEAT_GUI) \
            || defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE)
-           if (key_name[0] == (int)KS_MOUSE)
+           if (key_name[0] == KS_MOUSE
+#  ifdef FEAT_MOUSE_GPM
+                   || key_name[0] == KS_GPM_MOUSE
+#  endif
+              )
            {
                /*
                 * For xterm we get "<t_mouse>scr", where
@@ -5274,9 +5278,12 @@ check_termcode(
                modifiers = 0;
            }
 
-       if (key_name[0] == (int)KS_MOUSE
+       if (key_name[0] == KS_MOUSE
+#  ifdef FEAT_MOUSE_GPM
+           || key_name[0] == KS_GPM_MOUSE
+#  endif
 #  ifdef FEAT_MOUSE_URXVT
-           || key_name[0] == (int)KS_URXVT_MOUSE
+           || key_name[0] == KS_URXVT_MOUSE
 #  endif
            || key_name[0] == KS_SGR_MOUSE
            || key_name[0] == KS_SGR_MOUSE_RELEASE)
@@ -5293,7 +5300,7 @@ check_termcode(
                        && !gui.in_use
 #   endif
 #   ifdef FEAT_MOUSE_GPM
-                       && gpm_flag == 0
+                       && key_name[0] != KS_GPM_MOUSE
 #   endif
                        )
                {
@@ -5342,7 +5349,7 @@ check_termcode(
            }
 # endif /* !UNIX || FEAT_MOUSE_XTERM */
 # ifdef FEAT_MOUSE_NET
-           if (key_name[0] == (int)KS_NETTERM_MOUSE)
+           if (key_name[0] == KS_NETTERM_MOUSE)
            {
                int mc, mr;
 
@@ -5365,7 +5372,7 @@ check_termcode(
            }
 # endif        /* FEAT_MOUSE_NET */
 # ifdef FEAT_MOUSE_JSB
-           if (key_name[0] == (int)KS_JSBTERM_MOUSE)
+           if (key_name[0] == KS_JSBTERM_MOUSE)
            {
                int mult, val, iter, button, status;
 
@@ -5489,7 +5496,7 @@ check_termcode(
            }
 # endif /* FEAT_MOUSE_JSB */
 # ifdef FEAT_MOUSE_DEC
-           if (key_name[0] == (int)KS_DEC_MOUSE)
+           if (key_name[0] == KS_DEC_MOUSE)
            {
               /* The DEC Locator Input Model
                * Netterm delivers the code sequence:
@@ -5624,7 +5631,7 @@ check_termcode(
            }
 # endif /* FEAT_MOUSE_DEC */
 # ifdef FEAT_MOUSE_PTERM
-           if (key_name[0] == (int)KS_PTERM_MOUSE)
+           if (key_name[0] == KS_PTERM_MOUSE)
            {
                int button, num_clicks, action;
 
@@ -5705,14 +5712,14 @@ check_termcode(
            {
 # ifdef CHECK_DOUBLE_CLICK
 #  ifdef FEAT_MOUSE_GPM
-#   ifdef FEAT_GUI
                /*
-                * Only for Unix, when GUI or gpm is not active, we handle
-                * multi-clicks here.
+                * Only for Unix, when GUI not active, we handle
+                * multi-clicks here, but not for GPM mouse events.
                 */
-               if (gpm_flag == 0 && !gui.in_use)
+#   ifdef FEAT_GUI
+               if (key_name[0] != KS_GPM_MOUSE && !gui.in_use)
 #   else
-               if (gpm_flag == 0)
+               if (key_name[0] != KS_GPM_MOUSE)
 #   endif
 #  else
 #   ifdef FEAT_GUI
@@ -5800,7 +5807,7 @@ check_termcode(
 
            /* Work out our pseudo mouse event. Note that MOUSE_RELEASE gets
             * added, then it's not mouse up/down. */
-           key_name[0] = (int)KS_EXTRA;
+           key_name[0] = KS_EXTRA;
            if (wheel_code != 0
                              && (wheel_code & MOUSE_RELEASE) != MOUSE_RELEASE)
            {
index f2abf24005c6b06c2c0633d166ca6b5b4aa5dfe7..3edde60bf876ce877032cefbcda028f864e24983 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1265,
 /**/
     1264,
 /**/