aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/cmdexpand.c4
-rw-r--r--src/nvim/getchar.c2
-rw-r--r--src/nvim/insexpand.c7
-rw-r--r--src/nvim/menu.c7
4 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index f2776191b7..a400be6039 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -1328,8 +1328,8 @@ char *addstar(char *fname, size_t len, int context)
/// EXPAND_FILES After command with EX_XFILE set, or after setting
/// with P_EXPAND set. eg :e ^I, :w>>^I
/// EXPAND_DIRECTORIES In some cases this is used instead of the latter
-/// when we know only directories are of interest. eg
-/// :set dir=^I
+/// when we know only directories are of interest.
+/// E.g. :set dir=^I and :cd ^I
/// EXPAND_SHELLCMD After ":!cmd", ":r !cmd" or ":w !cmd".
/// EXPAND_SETTINGS Complete variable names. eg :set d^I
/// EXPAND_BOOL_SETTINGS Complete boolean variables only, eg :set no^I
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 69a371ccf9..15f2e6d06f 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -161,7 +161,7 @@ static char *get_buffcont(buffheader_T *buffer, int dozero)
count += strlen(bp->b_str);
}
- if (count || dozero) {
+ if (count > 0 || dozero) {
p = xmalloc(count + 1);
char *p2 = p;
for (const buffblock_T *bp = buffer->bh_first.b_next;
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index 800d7e29ca..5baf090f14 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -2651,7 +2651,7 @@ static void ins_compl_update_sequence_numbers(void)
compl_T *match;
if (compl_dir_forward()) {
- // search backwards for the first valid (!= -1) number.
+ // Search backwards for the first valid (!= -1) number.
// This should normally succeed already at the first loop
// cycle, so it's fast!
for (match = compl_curr_match->cp_prev;
@@ -2671,7 +2671,7 @@ static void ins_compl_update_sequence_numbers(void)
}
} else { // BACKWARD
assert(compl_direction == BACKWARD);
- // search forwards (upwards) for the first valid (!= -1)
+ // Search forwards (upwards) for the first valid (!= -1)
// number. This should normally succeed already at the
// first loop cycle, so it's fast!
for (match = compl_curr_match->cp_next;
@@ -2682,8 +2682,7 @@ static void ins_compl_update_sequence_numbers(void)
}
}
if (match != NULL) {
- // go down and assign all numbers which are not
- // assigned yet
+ // go down and assign all numbers which are not assigned yet
for (match = match->cp_prev;
match && match->cp_number == -1;
match = match->cp_prev) {
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index b9afa2e7a4..65b6363f4b 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -1450,7 +1450,8 @@ void show_popupmenu(void)
/// Execute "menu". Use by ":emenu" and the window toolbar.
/// @param eap NULL for the window toolbar.
-/// @param mode_idx specify a MENU_INDEX_ value, use -1 to depend on the current state
+/// @param mode_idx specify a MENU_INDEX_ value,
+/// use MENU_INDEX_INVALID to depend on the current state
void execute_menu(const exarg_T *eap, vimmenu_T *menu, int mode_idx)
FUNC_ATTR_NONNULL_ARG(2)
{
@@ -1458,7 +1459,7 @@ void execute_menu(const exarg_T *eap, vimmenu_T *menu, int mode_idx)
if (idx < 0) {
// Use the Insert mode entry when returning to Insert mode.
- if (((State & MODE_INSERT) || restart_edit) && !current_sctx.sc_sid) {
+ if (((State & MODE_INSERT) || restart_edit) && current_sctx.sc_sid == 0) {
idx = MENU_INDEX_INSERT;
} else if (State & MODE_CMDLINE) {
idx = MENU_INDEX_CMDLINE;
@@ -1612,7 +1613,7 @@ static vimmenu_T *menu_getbyname(char *name_arg)
void ex_emenu(exarg_T *eap)
{
char *arg = eap->arg;
- int mode_idx = -1;
+ int mode_idx = MENU_INDEX_INVALID;
if (arg[0] && ascii_iswhite(arg[1])) {
switch (arg[0]) {