summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-06-08 20:13:31 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-08 20:13:31 +0200
commit445f11d5bcfddfa194ebd12b029228c7e957f94c (patch)
treee68aafe3970bdd1e79daa1cc4c7432d21cdad23d
parentdc73b4b75de0134db3dffa6e631daf6cae817545 (diff)
patch 8.2.2963: GUI: mouse move may start Visual mode with a popup visiblev8.2.2963
Problem: GUI: mouse move may start Visual mode with a popup visible. Solution: Add special code for mouse move. (closes #8318)
-rw-r--r--src/gui.c5
-rw-r--r--src/keymap.h5
-rw-r--r--src/term.c4
-rw-r--r--src/version.c2
-rw-r--r--src/vim.h2
5 files changed, 15 insertions, 3 deletions
diff --git a/src/gui.c b/src/gui.c
index 2539a4f642..b5ec007405 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -3071,6 +3071,9 @@ gui_send_mouse_event(
*/
switch (button)
{
+ case MOUSE_MOVE:
+ button_char = KE_MOUSEMOVE_XY;
+ goto button_set;
case MOUSE_X1:
button_char = KE_X1MOUSE;
goto button_set;
@@ -4925,7 +4928,7 @@ gui_mouse_moved(int x, int y)
if (popup_visible)
// Generate a mouse-moved event, so that the popup can perhaps be
// closed, just like in the terminal.
- gui_send_mouse_event(MOUSE_DRAG, x, y, FALSE, 0);
+ gui_send_mouse_event(MOUSE_MOVE, x, y, FALSE, 0);
#endif
}
diff --git a/src/keymap.h b/src/keymap.h
index 6efb13d065..4ce5144d15 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -273,8 +273,9 @@ enum key_extra
, KE_FOCUSGAINED = 98 // focus gained
, KE_FOCUSLOST = 99 // focus lost
, KE_MOUSEMOVE = 100 // mouse moved with no button down
- , KE_CANCEL = 101 // return from vgetc()
- , KE_COMMAND = 102 // <Cmd> special key
+ , KE_MOUSEMOVE_XY = 101 // KE_MOUSEMOVE with coordinates
+ , KE_CANCEL = 102 // return from vgetc()
+ , KE_COMMAND = 103 // <Cmd> special key
};
/*
diff --git a/src/term.c b/src/term.c
index 99b33d4399..cec16b608a 100644
--- a/src/term.c
+++ b/src/term.c
@@ -5588,6 +5588,7 @@ check_termcode(
&& key_name[0] == (int)KS_EXTRA
&& (key_name[1] == (int)KE_X1MOUSE
|| key_name[1] == (int)KE_X2MOUSE
+ || key_name[1] == (int)KE_MOUSEMOVE_XY
|| key_name[1] == (int)KE_MOUSELEFT
|| key_name[1] == (int)KE_MOUSERIGHT
|| key_name[1] == (int)KE_MOUSEDOWN
@@ -5601,6 +5602,9 @@ check_termcode(
mouse_col = 128 * (bytes[0] - ' ' - 1) + bytes[1] - ' ' - 1;
mouse_row = 128 * (bytes[2] - ' ' - 1) + bytes[3] - ' ' - 1;
slen += num_bytes;
+ // equal to K_MOUSEMOVE
+ if (key_name[1] == (int)KE_MOUSEMOVE_XY)
+ key_name[1] = (int)KE_MOUSEMOVE;
}
else
#endif
diff --git a/src/version.c b/src/version.c
index 08cb9c98e8..cea97e8c5e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2963,
+/**/
2962,
/**/
2961,
diff --git a/src/vim.h b/src/vim.h
index 10f032f2b2..61afe97309 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -1859,6 +1859,8 @@ typedef int sock_T;
#define MOUSE_6 0x500 // scroll wheel left
#define MOUSE_7 0x600 // scroll wheel right
+#define MOUSE_MOVE 0x700 // report mouse moved
+
// 0x20 is reserved by xterm
#define MOUSE_DRAG_XTERM 0x40