comparison src/menu.c @ 19934:3ff714d765ba v8.2.0523

patch 8.2.0523: loops are repeated Commit: https://github.com/vim/vim/commit/00d253e2b2f435a5386582c3f857008e7ac355c2 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 6 22:13:01 2020 +0200 patch 8.2.0523: loops are repeated Problem: Loops are repeated. Solution: Use FOR_ALL_ macros. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5882)
author Bram Moolenaar <Bram@vim.org>
date Mon, 06 Apr 2020 22:15:39 +0200
parents d64f403289db
children 513c62184ed8
comparison
equal deleted inserted replaced
19933:005e707a7988 19934:3ff714d765ba
1978 mode = menu_mode_chars[menu_mode]; 1978 mode = menu_mode_chars[menu_mode];
1979 mode_len = (int)strlen(mode); 1979 mode_len = (int)strlen(mode);
1980 1980
1981 apply_autocmds(EVENT_MENUPOPUP, (char_u*)mode, NULL, FALSE, curbuf); 1981 apply_autocmds(EVENT_MENUPOPUP, (char_u*)mode, NULL, FALSE, curbuf);
1982 1982
1983 for (menu = root_menu; menu != NULL; menu = menu->next) 1983 FOR_ALL_MENUS(menu)
1984 if (STRNCMP("PopUp", menu->name, 5) == 0 && STRNCMP(menu->name + 5, mode, mode_len) == 0) 1984 if (STRNCMP("PopUp", menu->name, 5) == 0 && STRNCMP(menu->name + 5, mode, mode_len) == 0)
1985 break; 1985 break;
1986 1986
1987 // Only show a popup when it is defined and has entries 1987 // Only show a popup when it is defined and has entries
1988 if (menu != NULL && menu->children != NULL) 1988 if (menu != NULL && menu->children != NULL)
2131 { 2131 {
2132 vimmenu_T *menu; 2132 vimmenu_T *menu;
2133 2133
2134 if (key < 256) 2134 if (key < 256)
2135 key = TOLOWER_LOC(key); 2135 key = TOLOWER_LOC(key);
2136 for (menu = root_menu; menu != NULL; menu = menu->next) 2136 FOR_ALL_MENUS(menu)
2137 if (menu->mnemonic == key 2137 if (menu->mnemonic == key
2138 || (menu->mnemonic < 256 && TOLOWER_LOC(menu->mnemonic) == key)) 2138 || (menu->mnemonic < 256 && TOLOWER_LOC(menu->mnemonic) == key))
2139 return TRUE; 2139 return TRUE;
2140 return FALSE; 2140 return FALSE;
2141 } 2141 }