Patch 8.2.2963

6 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 8, 2021, 2:14:55 PM6/8/21
to vim...@googlegroups.com

Patch 8.2.2963
Problem: GUI: mouse move may start Visual mode with a popup visible.
Solution: Add special code for mouse move. (closes #8318)
Files: src/vim.h, src/gui.c, src/keymap.h, src/term.c


*** ../vim-8.2.2962/src/vim.h 2021-05-30 22:17:21.035457554 +0200
--- src/vim.h 2021-06-08 19:27:45.804919156 +0200
***************
*** 1859,1864 ****
--- 1859,1866 ----
#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

*** ../vim-8.2.2962/src/gui.c 2021-05-29 12:21:54.948859803 +0200
--- src/gui.c 2021-06-08 20:05:35.072823001 +0200
***************
*** 3071,3076 ****
--- 3071,3079 ----
*/
switch (button)
{
+ case MOUSE_MOVE:
+ button_char = KE_MOUSEMOVE_XY;
+ goto button_set;
case MOUSE_X1:
button_char = KE_X1MOUSE;
goto button_set;
***************
*** 4925,4931 ****
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);
#endif
}

--- 4928,4934 ----
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_MOVE, x, y, FALSE, 0);
#endif
}

*** ../vim-8.2.2962/src/keymap.h 2020-11-12 14:20:32.021927293 +0100
--- src/keymap.h 2021-06-08 20:00:10.929435143 +0200
***************
*** 273,280 ****
, 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
};

/*
--- 273,281 ----
, KE_FOCUSGAINED = 98 // focus gained
, KE_FOCUSLOST = 99 // focus lost
, KE_MOUSEMOVE = 100 // mouse moved with no button down
! , KE_MOUSEMOVE_XY = 101 // KE_MOUSEMOVE with coordinates
! , KE_CANCEL = 102 // return from vgetc()
! , KE_COMMAND = 103 // <Cmd> special key
};

/*
*** ../vim-8.2.2962/src/term.c 2021-06-02 13:28:11.439120443 +0200
--- src/term.c 2021-06-08 20:02:17.121198284 +0200
***************
*** 5588,5593 ****
--- 5588,5594 ----
&& 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,5606 ****
--- 5602,5610 ----
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
*** ../vim-8.2.2962/src/version.c 2021-06-08 18:32:31.499453482 +0200
--- src/version.c 2021-06-08 20:12:54.727979537 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2963,
/**/

--
SOLDIER: What? A swallow carrying a coconut?
ARTHUR: It could grip it by the husk ...
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages