1
0
forked from aniani/vim

patch 8.1.1274: after :unmenu can still execute the menu with :emenu

Problem:    After :unmenu can still execute the menu with :emenu.
Solution:   Do not execute a menu that was disabled for the specified mode.
This commit is contained in:
Bram Moolenaar
2019-05-05 14:19:20 +02:00
parent f653a6bcff
commit ce79353ace
3 changed files with 20 additions and 2 deletions

View File

@@ -2337,7 +2337,8 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx)
if (idx == -1 || eap == NULL)
idx = MENU_INDEX_NORMAL;
if (idx != MENU_INDEX_INVALID && menu->strings[idx] != NULL)
if (idx != MENU_INDEX_INVALID && menu->strings[idx] != NULL
&& (menu->modes & (1 << idx)))
{
/* When executing a script or function execute the commands right now.
* Also for the window toolbar.