To: vim_dev@googlegroups.com Subject: Patch 8.1.1274 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1274 Problem: After :unmenu can still execute the menu with :emenu. Solution: Do not execute a menu that was disabled for the specified mode. Files: src/menu.c, src/testdir/test_menu.vim *** ../vim-8.1.1273/src/menu.c 2019-05-04 16:55:15.786921815 +0200 --- src/menu.c 2019-05-05 14:08:55.709800738 +0200 *************** *** 2337,2343 **** if (idx == -1 || eap == NULL) idx = MENU_INDEX_NORMAL; ! if (idx != MENU_INDEX_INVALID && menu->strings[idx] != NULL) { /* When executing a script or function execute the commands right now. * Also for the window toolbar. --- 2337,2344 ---- if (idx == -1 || eap == NULL) idx = MENU_INDEX_NORMAL; ! 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. *** ../vim-8.1.1273/src/testdir/test_menu.vim 2018-10-19 22:35:04.889189955 +0200 --- src/testdir/test_menu.vim 2019-05-05 14:18:23.034607663 +0200 *************** *** 54,61 **** emenu c Test.FooBar call assert_equal('cmdline', g:did_menu) ! aunmenu Test.FooBar tlunmenu Test.FooBar call assert_fails('emenu n Test.FooBar', 'E334:') nmenu 2 Test.FooBar.Child :let g:did_menu = 'foobar' --- 54,76 ---- emenu c Test.FooBar call assert_equal('cmdline', g:did_menu) ! nunmenu Test.FooBar ! call assert_fails('emenu n Test.FooBar', 'E335: Menu not defined for Normal mode') ! vunmenu Test.FooBar ! call assert_fails('emenu v Test.FooBar', 'E335: Menu not defined for Visual mode') ! vmenu 2 Test.FooBar :let g:did_menu = 'visual' ! sunmenu Test.FooBar ! call assert_fails('emenu s Test.FooBar', 'E335: Menu not defined for Select mode') ! ounmenu Test.FooBar ! call assert_fails('emenu o Test.FooBar', 'E335: Menu not defined for Op-pending mode') ! iunmenu Test.FooBar ! call assert_fails('emenu i Test.FooBar', 'E335: Menu not defined for Insert mode') ! cunmenu Test.FooBar ! call assert_fails('emenu c Test.FooBar', 'E335: Menu not defined for Cmdline mode') tlunmenu Test.FooBar + call assert_fails('emenu t Test.FooBar', 'E335: Menu not defined for Terminal mode') + + aunmenu Test.FooBar call assert_fails('emenu n Test.FooBar', 'E334:') nmenu 2 Test.FooBar.Child :let g:did_menu = 'foobar' *** ../vim-8.1.1273/src/version.c 2019-05-05 13:19:59.322159435 +0200 --- src/version.c 2019-05-05 14:10:37.625221849 +0200 *************** *** 769,770 **** --- 769,772 ---- { /* Add new patch number below this line */ + /**/ + 1274, /**/ -- ROBIN: (warily) And if you get a question wrong? ARTHUR: You are cast into the Gorge of Eternal Peril. ROBIN: Oh ... wacho! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///