summaryrefslogtreecommitdiffstats
path: root/src/insexpand.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-18 19:23:45 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-18 19:23:45 +0200
commitf0bc15c769b60f472d411b3ef98d57db510113c1 (patch)
tree7f970397d8e98743ab01e33b707de5a97ded25ac /src/insexpand.c
parent9513d91be02f654658b8b33ff429a52ff3c4de12 (diff)
patch 8.1.1884: cannot use mouse scroll wheel in popup in Insert modev8.1.1884
Problem: Cannot use mouse scroll wheel in popup in Insert mode. Mouse clicks in popup close the popup menu. Solution: Check if the mouse is in a popup window. Do not let mouse events close the popup menu. (closes #4544)
Diffstat (limited to 'src/insexpand.c')
-rw-r--r--src/insexpand.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/insexpand.c b/src/insexpand.c
index 136fb67f01..a86630f621 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -1943,6 +1943,36 @@ ins_compl_prep(int c)
|| c == K_MOUSELEFT || c == K_MOUSERIGHT)
return retval;
+#ifdef FEAT_TEXT_PROP
+ // Ignore mouse events in a popup window
+ if (is_mouse_key(c))
+ {
+ // Ignore drag and release events, the position does not need to be in
+ // the popup and it may have just closed.
+ if (c == K_LEFTRELEASE
+ || c == K_LEFTRELEASE_NM
+ || c == K_MIDDLERELEASE
+ || c == K_RIGHTRELEASE
+ || c == K_X1RELEASE
+ || c == K_X2RELEASE
+ || c == K_LEFTDRAG
+ || c == K_MIDDLEDRAG
+ || c == K_RIGHTDRAG
+ || c == K_X1DRAG
+ || c == K_X2DRAG)
+ return retval;
+ if (popup_visible)
+ {
+ int row = mouse_row;
+ int col = mouse_col;
+ win_T *wp = mouse_find_win(&row, &col, FIND_POPUP);
+
+ if (wp != NULL && WIN_IS_POPUP(wp))
+ return retval;
+ }
+ }
+#endif
+
// Set "compl_get_longest" when finding the first matches.
if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET
|| (ctrl_x_mode == CTRL_X_NORMAL && !compl_started))