summaryrefslogtreecommitdiff
path: root/src/popupmnu.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/popupmnu.c
parent9513d91be02f654658b8b33ff429a52ff3c4de12 (diff)
downloadvim-git-f0bc15c769b60f472d411b3ef98d57db510113c1.tar.gz
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/popupmnu.c')
-rw-r--r--src/popupmnu.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/popupmnu.c b/src/popupmnu.c
index 97b2fff1e..4d84ba843 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -638,6 +638,7 @@ pum_set_selected(int n, int repeat)
{
int resized = FALSE;
int context = pum_height / 2;
+ int prev_selected = pum_selected;
#ifdef FEAT_TEXT_PROP
int has_info = FALSE;
#endif
@@ -826,7 +827,16 @@ pum_set_selected(int n, int repeat)
curbuf->b_changed = 0;
curbuf->b_p_ma = FALSE;
- curwin->w_cursor.lnum = 1;
+ if (pum_selected != prev_selected)
+ {
+# ifdef FEAT_TEXT_PROP
+ curwin->w_firstline = 1;
+# endif
+ curwin->w_topline = 1;
+ }
+ else if (curwin->w_topline > curbuf->b_ml.ml_line_count)
+ curwin->w_topline = curbuf->b_ml.ml_line_count;
+ curwin->w_cursor.lnum = curwin->w_topline;
curwin->w_cursor.col = 0;
if (use_popup && win_valid(curwin_save))
redraw_win_later(curwin_save, SOME_VALID);