aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/menu.c')
-rw-r--r--src/nvim/menu.c57
1 files changed, 23 insertions, 34 deletions
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index 16802a4e50..cb6918cd27 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -23,7 +23,7 @@
#include "nvim/memory.h"
#include "nvim/menu.h"
#include "nvim/message.h"
-#include "nvim/popupmnu.h"
+#include "nvim/popupmenu.h"
#include "nvim/screen.h"
#include "nvim/state.h"
#include "nvim/strings.h"
@@ -419,7 +419,7 @@ static int add_menu_path(const char *const menu_path, vimmenu_T *menuarg, const
p = (call_data == NULL) ? NULL : xstrdup(call_data);
// loop over all modes, may add more than one
- for (i = 0; i < MENU_MODES; ++i) {
+ for (i = 0; i < MENU_MODES; i++) {
if (modes & (1 << i)) {
// free any old menu
free_menu_string(menu, i);
@@ -853,7 +853,7 @@ static void show_menus_recursive(vimmenu_T *menu, int modes, int depth)
msg_puts(" ");
}
// Same highlighting as for directories!?
- msg_outtrans_attr((char_u *)menu->name, HL_ATTR(HLF_D));
+ msg_outtrans_attr(menu->name, HL_ATTR(HLF_D));
}
if (menu != NULL && menu->children == NULL) {
@@ -914,7 +914,7 @@ static void show_menus_recursive(vimmenu_T *menu, int modes, int depth)
*/
static vimmenu_T *expand_menu = NULL;
static int expand_modes = 0x0;
-static int expand_emenu; // TRUE for ":emenu" command
+static int expand_emenu; // true for ":emenu" command
/*
* Work out what to complete when doing command line completion of menu names.
@@ -933,7 +933,7 @@ char *set_context_in_menu_cmd(expand_T *xp, const char *cmd, char *arg, bool for
xp->xp_context = EXPAND_UNSUCCESSFUL;
// Check for priority numbers, enable and disable
- for (p = arg; *p; ++p) {
+ for (p = arg; *p; p++) {
if (!ascii_isdigit(*p) && *p != '.') {
break;
}
@@ -952,12 +952,12 @@ char *set_context_in_menu_cmd(expand_T *xp, const char *cmd, char *arg, bool for
}
while (*p != NUL && ascii_iswhite(*p)) {
- ++p;
+ p++;
}
arg = after_dot = p;
- for (; *p && !ascii_iswhite(*p); ++p) {
+ for (; *p && !ascii_iswhite(*p); p++) {
if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL) {
p++;
} else if (*p == '.') {
@@ -1056,7 +1056,7 @@ char *get_menu_name(expand_T *xp, int idx)
} else {
str = menu->dname;
if (menu->en_dname == NULL) {
- should_advance = TRUE;
+ should_advance = true;
}
}
} else {
@@ -1163,10 +1163,8 @@ char *menu_name_skip(char *const name)
return p;
}
-/*
- * Return TRUE when "name" matches with menu "menu". The name is compared in
- * two ways: raw menu name and menu name without '&'. ignore part after a TAB.
- */
+/// Return true when "name" matches with menu "menu". The name is compared in
+/// two ways: raw menu name and menu name without '&'. ignore part after a TAB.
static bool menu_name_equal(const char *const name, const vimmenu_T *const menu)
{
if (menu->en_name != NULL
@@ -1181,7 +1179,7 @@ static bool menu_namecmp(const char *const name, const char *const mname)
{
int i;
- for (i = 0; name[i] != NUL && name[i] != TAB; ++i) {
+ for (i = 0; name[i] != NUL && name[i] != TAB; i++) {
if (name[i] != mname[i]) {
break;
}
@@ -1405,10 +1403,8 @@ bool menu_is_toolbar(const char *const name)
return STRNCMP(name, "ToolBar", 7) == 0;
}
-/*
- * Return TRUE if the name is a menu separator identifier: Starts and ends
- * with '-'
- */
+/// Return true if the name is a menu separator identifier: Starts and ends
+/// with '-'
int menu_is_separator(char *name)
{
return name[0] == '-' && name[STRLEN(name) - 1] == '-';
@@ -1659,26 +1655,19 @@ void ex_emenu(exarg_T *eap)
if (arg[0] && ascii_iswhite(arg[1])) {
switch (arg[0]) {
case 'n':
- mode_idx = MENU_INDEX_NORMAL;
- break;
+ mode_idx = MENU_INDEX_NORMAL; break;
case 'v':
- mode_idx = MENU_INDEX_VISUAL;
- break;
+ mode_idx = MENU_INDEX_VISUAL; break;
case 's':
- mode_idx = MENU_INDEX_SELECT;
- break;
+ mode_idx = MENU_INDEX_SELECT; break;
case 'o':
- mode_idx = MENU_INDEX_OP_PENDING;
- break;
+ mode_idx = MENU_INDEX_OP_PENDING; break;
case 't':
- mode_idx = MENU_INDEX_TERMINAL;
- break;
+ mode_idx = MENU_INDEX_TERMINAL; break;
case 'i':
- mode_idx = MENU_INDEX_INSERT;
- break;
+ mode_idx = MENU_INDEX_INSERT; break;
case 'c':
- mode_idx = MENU_INDEX_CMDLINE;
- break;
+ mode_idx = MENU_INDEX_CMDLINE; break;
default:
semsg(_(e_invarg2), arg);
return;
@@ -1814,9 +1803,9 @@ static char *menu_skip_part(char *p)
{
while (*p != NUL && *p != '.' && !ascii_iswhite(*p)) {
if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL) {
- ++p;
+ p++;
}
- ++p;
+ p++;
}
return p;
}
@@ -1952,7 +1941,7 @@ static void menuitem_getinfo(const char *menu_name, const vimmenu_T *menu, int m
/// "menu_info()" function
/// Return information about a menu (including all the child menus)
-void f_menu_info(typval_T *argvars, typval_T *rettv, FunPtr fptr)
+void f_menu_info(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
tv_dict_alloc_ret(rettv);
dict_T *const retdict = rettv->vval.v_dict;