diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-07-16 02:48:04 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-01 15:28:49 -0400 |
commit | f35df8d697a8c9d2ecc2cd9585c13d8d418cd48f (patch) | |
tree | 38ecb770f989a6c58df295c918ce817eb68f1366 | |
parent | f193b5241f8f9fe334506b1f30439507245de10f (diff) | |
download | rneovim-f35df8d697a8c9d2ecc2cd9585c13d8d418cd48f.tar.gz rneovim-f35df8d697a8c9d2ecc2cd9585c13d8d418cd48f.tar.bz2 rneovim-f35df8d697a8c9d2ecc2cd9585c13d8d418cd48f.zip |
menu: enable in ex_menu() is TriState
-rw-r--r-- | src/nvim/menu.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 968962c894..a56aa82f39 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -63,8 +63,8 @@ ex_menu(exarg_T *eap) char_u *p; int i; long pri_tab[MENUDEPTH + 1]; - int enable = MAYBE; /* TRUE for "menu enable", FALSE for "menu - * disable */ + TriState enable = kNone; // kTrue for "menu enable", + // kFalse for "menu disable vimmenu_T menuarg; modes = get_menu_cmd_modes(eap->cmd, eap->forceit, &noremap, &unmenu); @@ -133,10 +133,10 @@ ex_menu(exarg_T *eap) * Check for "disable" or "enable" argument. */ if (STRNCMP(arg, "enable", 6) == 0 && ascii_iswhite(arg[6])) { - enable = TRUE; + enable = kTrue; arg = skipwhite(arg + 6); } else if (STRNCMP(arg, "disable", 7) == 0 && ascii_iswhite(arg[7])) { - enable = FALSE; + enable = kFalse; arg = skipwhite(arg + 7); } @@ -160,22 +160,21 @@ ex_menu(exarg_T *eap) /* * If there is only a menu name, display menus with that name. */ - if (*map_to == NUL && !unmenu && enable == MAYBE) { + if (*map_to == NUL && !unmenu && enable == kNone) { show_menus(menu_path, modes); goto theend; - } else if (*map_to != NUL && (unmenu || enable != MAYBE)) { + } else if (*map_to != NUL && (unmenu || enable != kNone)) { EMSG(_(e_trailing)); goto theend; } - if (enable != MAYBE) { - /* - * Change sensitivity of the menu. - * For the PopUp menu, remove a menu for each mode separately. - * Careful: menu_nable_recurse() changes menu_path. - */ - if (STRCMP(menu_path, "*") == 0) /* meaning: do all menus */ + if (enable != kNone) { + // Change sensitivity of the menu. + // For the PopUp menu, remove a menu for each mode separately. + // Careful: menu_nable_recurse() changes menu_path. + if (STRCMP(menu_path, "*") == 0) { // meaning: do all menus menu_path = (char_u *)""; + } if (menu_is_popup(menu_path)) { for (i = 0; i < MENU_INDEX_TIP; ++i) |