summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-04 16:58:45 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-04 16:58:45 +0200
commitbedf091a951bdcd5f9f13839c0aaf2e395a635f6 (patch)
treecd1e9187410904f63d35592d9e476f95ab8b29f2
parentd2fad67e3eb71f48d23f283ef8e7b7ddf4ee180f (diff)
downloadvim-git-8.1.1265.tar.gz
patch 8.1.1265: when GPM mouse support is enabled double clicks do not workv8.1.1265
Problem: When GPM mouse support is enabled double clicks in xterm do not work. Solution: Use KS_GPM_MOUSE for GPM mouse events.
-rw-r--r--src/keymap.h3
-rw-r--r--src/os_unix.c8
-rw-r--r--src/term.c41
-rw-r--r--src/version.c2
4 files changed, 35 insertions, 19 deletions
diff --git a/src/keymap.h b/src/keymap.h
index d6dd5cbb3..47294f028 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -114,6 +114,9 @@
#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
*/
diff --git a/src/os_unix.c b/src/os_unix.c
index ba5d386bb..9f8a7b110 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -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().
*/
diff --git a/src/term.c b/src/term.c
index 4a39fe3df..bcc3dd387 100644
--- a/src/term.c
+++ b/src/term.c
@@ -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)
{
diff --git a/src/version.c b/src/version.c
index f2abf2400..3edde60bf 100644
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1265,
+/**/
1264,
/**/
1263,