summaryrefslogtreecommitdiff
path: root/src/gui.c
diff options
context:
space:
mode:
authorErnie Rael <errael@raelity.com>2022-04-03 15:47:28 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-03 15:47:28 +0100
commitc4cb544cd5beaa864b3893e4b8d0085393c7dbce (patch)
tree3e04f56d7b0a6d71d3bcb40c9107b031cf5bd949 /src/gui.c
parent8ef6997e2d90808dec033373c96dda68843af12e (diff)
downloadvim-git-c4cb544cd5beaa864b3893e4b8d0085393c7dbce.tar.gz
patch 8.2.4674: cannot force getting MouseMove eventsv8.2.4674
Problem: Cannot force getting MouseMove events. Solution: Add the 'mousemoveevent' option with implementaiton for the GUI. (Ernie Rael, closes #10044)
Diffstat (limited to 'src/gui.c')
-rw-r--r--src/gui.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/gui.c b/src/gui.c
index 3e383a4b4..3b8c0d0a8 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -3142,13 +3142,26 @@ button_set:
if (hold_gui_events)
return;
+ row = gui_xy2colrow(x, y, &col);
+ // Don't report a mouse move unless moved to a
+ // different character position.
+ if (button == MOUSE_MOVE)
+ {
+ if (row == prev_row && col == prev_col)
+ return;
+ else
+ {
+ prev_row = row >= 0 ? row : 0;
+ prev_col = col;
+ }
+ }
+
string[3] = CSI;
string[4] = KS_EXTRA;
string[5] = (int)button_char;
// Pass the pointer coordinates of the scroll event so that we
// know which window to scroll.
- row = gui_xy2colrow(x, y, &col);
string[6] = (char_u)(col / 128 + ' ' + 1);
string[7] = (char_u)(col % 128 + ' ' + 1);
string[8] = (char_u)(row / 128 + ' ' + 1);
@@ -4967,12 +4980,14 @@ gui_mouse_moved(int x, int y)
// apply 'mousefocus' and pointer shape
gui_mouse_focus(x, y);
+ if (p_mousemev
#ifdef FEAT_PROP_POPUP
- if (popup_uses_mouse_move)
- // Generate a mouse-moved event, so that the popup can perhaps be
- // closed, just like in the terminal.
- gui_send_mouse_event(MOUSE_MOVE, x, y, FALSE, 0);
+ || popup_uses_mouse_move
#endif
+ )
+ // Generate a mouse-moved event. For a <MouseMove> mapping. Or so the
+ // popup can perhaps be closed, just like in the terminal.
+ gui_send_mouse_event(MOUSE_MOVE, x, y, FALSE, 0);
}
/*