summaryrefslogtreecommitdiff
path: root/src/popupmnu.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-06 11:43:04 +0100
committerBram Moolenaar <Bram@vim.org>2018-03-06 11:43:04 +0100
commit987723e084660290270b3c3d943eb13bd828d5da (patch)
treee7f0329145672eccca05d6e4498b8345bf2c8e8c /src/popupmnu.c
parent89894aa671ed1db03d95d38cab300702c242239d (diff)
downloadvim-git-987723e084660290270b3c3d943eb13bd828d5da.tar.gz
patch 8.0.1574: show cursor in wrong place when using popup menuv8.0.1574
Problem: Show cursor in wrong place when using popup menu. (Wei Zhang) Solution: Force updating the cursor position. Fix skipping over unused entries.
Diffstat (limited to 'src/popupmnu.c')
-rw-r--r--src/popupmnu.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/popupmnu.c b/src/popupmnu.c
index 9b5f750f8..985a0e62f 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -1104,14 +1104,14 @@ pum_select_mouse_pos(void)
* Execute the currently selected popup menu item.
*/
static void
-pum_execute_menu(vimmenu_T *menu)
+pum_execute_menu(vimmenu_T *menu, int mode)
{
vimmenu_T *mp;
int idx = 0;
exarg_T ea;
for (mp = menu->children; mp != NULL; mp = mp->next)
- if (idx++ == pum_selected)
+ if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected)
{
vim_memset(&ea, 0, sizeof(ea));
execute_menu(&ea, mp);
@@ -1171,7 +1171,7 @@ pum_show_popupmenu(vimmenu_T *menu)
int c;
pum_redraw();
- setcursor();
+ setcursor_mayforce(TRUE);
out_flush();
c = vgetc();
@@ -1180,7 +1180,7 @@ pum_show_popupmenu(vimmenu_T *menu)
else if (c == CAR || c == NL)
{
/* enter: select current item, if any, and close */
- pum_execute_menu(menu);
+ pum_execute_menu(menu, mode);
break;
}
else if (c == 'k' || c == K_UP || c == K_MOUSEUP)
@@ -1221,7 +1221,7 @@ pum_show_popupmenu(vimmenu_T *menu)
pum_select_mouse_pos();
if (pum_selected >= 0)
{
- pum_execute_menu(menu);
+ pum_execute_menu(menu, mode);
break;
}
if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM)