Patch 8.2.4619

5 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 24, 2022, 11:16:00 AM3/24/22
to vim...@googlegroups.com

Patch 8.2.4619
Problem: Mapping is cancelled when mouse moves and popup is visible.
Solution: Only generate mouse moved events when a popup may use them.
(closes #10004)
Files: src/gui.c, src/globals.h, src/popupwin.c


*** ../vim-8.2.4618/src/gui.c 2022-02-03 13:05:28.809273683 +0000
--- src/gui.c 2022-03-24 15:05:38.554640069 +0000
***************
*** 4968,4974 ****
gui_mouse_focus(x, y);

#ifdef FEAT_PROP_POPUP
! 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);
--- 4968,4974 ----
gui_mouse_focus(x, y);

#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);
*** ../vim-8.2.4618/src/globals.h 2022-03-10 19:23:24.333580627 +0000
--- src/globals.h 2022-03-24 14:57:37.216556504 +0000
***************
*** 736,741 ****
--- 736,744 ----
// Set to TRUE if there is any visible popup window.
EXTERN int popup_visible INIT(= FALSE);

+ // Set to TRUE if a visible popup window may use a MOUSE_MOVE event
+ EXTERN int popup_uses_mouse_move INIT(= FALSE);
+
EXTERN int text_prop_frozen INIT(= 0);
#endif

*** ../vim-8.2.4618/src/popupwin.c 2022-03-15 10:22:35.067373154 +0000
--- src/popupwin.c 2022-03-24 15:03:34.239099508 +0000
***************
*** 150,155 ****
--- 150,178 ----
wp->w_popup_mouse_maxcol = mouse_col;
}

+ static void
+ update_popup_uses_mouse_move(void)
+ {
+ popup_uses_mouse_move = FALSE;
+ if (popup_visible)
+ {
+ win_T *wp;
+
+ FOR_ALL_POPUPWINS(wp)
+ if (wp->w_popup_mouse_row != 0)
+ {
+ popup_uses_mouse_move = TRUE;
+ return;
+ }
+ FOR_ALL_POPUPWINS_IN_TAB(curtab, wp)
+ if (wp->w_popup_mouse_row != 0)
+ {
+ popup_uses_mouse_move = TRUE;
+ return;
+ }
+ }
+ }
+
/*
* Used when popup options contain "moved" with "word" or "WORD".
*/
***************
*** 3586,3592 ****
/*
* Update "popup_mask" if needed.
* Also recomputes the popup size and positions.
! * Also updates "popup_visible".
* Also marks window lines for redrawing.
*/
void
--- 3609,3615 ----
/*
* Update "popup_mask" if needed.
* Also recomputes the popup size and positions.
! * Also updates "popup_visible" and "popup_uses_mouse_move".
* Also marks window lines for redrawing.
*/
void
***************
*** 3755,3760 ****
--- 3778,3785 ----

vim_free(plines_cache);
}
+
+ update_popup_uses_mouse_move();
}

/*
*** ../vim-8.2.4618/src/version.c 2022-03-24 13:08:31.883820059 +0000
--- src/version.c 2022-03-24 14:44:00.297868145 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4619,
/**/

--
GUARD #2: Wait a minute -- supposing two swallows carried it together?
GUARD #1: No, they'd have to have it on a line.
GUARD #2: Well, simple! They'd just use a standard creeper!
GUARD #1: What, held under the dorsal guiding feathers?
GUARD #2: Well, why not?
The Quest for the Holy Grail (Monty Python)

/// 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