diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-10 08:46:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 08:46:42 +0800 |
commit | dc7edce650bc2abbcad2fdc12cb77561b36b35af (patch) | |
tree | c6c1320caf512b85b014d2b720e6406a90a126d6 /src | |
parent | 364b131f42509326c912c9b0fef5dfc94ed23b41 (diff) | |
download | rneovim-dc7edce650bc2abbcad2fdc12cb77561b36b35af.tar.gz rneovim-dc7edce650bc2abbcad2fdc12cb77561b36b35af.tar.bz2 rneovim-dc7edce650bc2abbcad2fdc12cb77561b36b35af.zip |
vim-patch:partial:9.0.1166: code is indented more than necessary (#21716)
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes vim/vim#11792)
https://github.com/vim/vim/commit/1cfb14aa972ccf3235ac67f07b7db1175b7c5384
Partial port as some highlight.c changes depend on previous patches.
Cherry-pick fname_match() change from patch 8.2.4959.
Omit internal_func_check_arg_types(): only used for Vim9 script.
N/A patches for version.c:
vim-patch:9.0.1167: EditorConfig files do not have their own filetype
Problem: EditorConfig files do not have their own filetype.
Solution: Add the "editorconfig" filetype. (Gregory Anders, closes vim/vim#11779)
https://github.com/vim/vim/commit/d41262ed06564cef98a3800e2928e6e0db91abbf
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/autocmd.c | 21 | ||||
-rw-r--r-- | src/nvim/buffer.c | 73 | ||||
-rw-r--r-- | src/nvim/cmdexpand.c | 29 | ||||
-rw-r--r-- | src/nvim/debugger.c | 45 | ||||
-rw-r--r-- | src/nvim/digraph.c | 45 | ||||
-rw-r--r-- | src/nvim/eval/funcs.c | 106 | ||||
-rw-r--r-- | src/nvim/eval/window.c | 66 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 44 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 14 | ||||
-rw-r--r-- | src/nvim/fold.c | 2 | ||||
-rw-r--r-- | src/nvim/highlight_group.c | 111 | ||||
-rw-r--r-- | src/nvim/indent_c.c | 1 |
12 files changed, 295 insertions, 262 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 3ed3f7edf2..01ebdfdafe 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -2676,19 +2676,20 @@ static int arg_augroup_get(char **argp) { char *p; char *arg = *argp; - int group = AUGROUP_ALL; for (p = arg; *p && !ascii_iswhite(*p) && *p != '|'; p++) {} - if (p > arg) { - char *group_name = xstrnsave(arg, (size_t)(p - arg)); - group = augroup_find(group_name); - if (group == AUGROUP_ERROR) { - group = AUGROUP_ALL; // no match, use all groups - } else { - *argp = skipwhite(p); // match, skip over group name - } - xfree(group_name); + if (p <= arg) { + return AUGROUP_ALL; + } + + char *group_name = xstrnsave(arg, (size_t)(p - arg)); + int group = augroup_find(group_name); + if (group == AUGROUP_ERROR) { + group = AUGROUP_ALL; // no match, use all groups + } else { + *argp = skipwhite(p); // match, skip over group name } + xfree(group_name); return group; } diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 1bba146caf..cd1059eb0d 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -359,8 +359,9 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags_arg) } apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, false, curbuf, &retval); + // if (retval != OK) { if (retval == FAIL) { - return FAIL; + return retval; } // The autocommands may have changed the current buffer. Apply the @@ -2473,19 +2474,22 @@ static char *fname_match(regmatch_T *rmp, char *name, bool ignore_case) char *match = NULL; char *p; - if (name != NULL) { - // Ignore case when 'fileignorecase' or the argument is set. - rmp->rm_ic = p_fic || ignore_case; - if (vim_regexec(rmp, name, (colnr_T)0)) { + // extra check for valid arguments + if (name == NULL || rmp->regprog == NULL) { + return NULL; + } + + // Ignore case when 'fileignorecase' or the argument is set. + rmp->rm_ic = p_fic || ignore_case; + if (vim_regexec(rmp, name, (colnr_T)0)) { + match = name; + } else if (rmp->regprog != NULL) { + // Replace $(HOME) with '~' and try matching again. + p = home_replace_save(NULL, name); + if (vim_regexec(rmp, p, (colnr_T)0)) { match = name; - } else if (rmp->regprog != NULL) { - // Replace $(HOME) with '~' and try matching again. - p = home_replace_save(NULL, name); - if (vim_regexec(rmp, p, (colnr_T)0)) { - match = name; - } - xfree(p); } + xfree(p); } return match; @@ -2592,17 +2596,18 @@ void buflist_setfpos(buf_T *const buf, win_T *const win, linenr_T lnum, colnr_T static bool wininfo_other_tab_diff(wininfo_T *wip) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { - if (wip->wi_opt.wo_diff) { - FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { - // return false when it's a window in the current tab page, thus - // the buffer was in diff mode here - if (wip->wi_win == wp) { - return false; - } + if (!wip->wi_opt.wo_diff) { + return false; + } + + FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { + // return false when it's a window in the current tab page, thus + // the buffer was in diff mode here + if (wip->wi_win == wp) { + return false; } - return true; } - return false; + return true; } /// Find info for the current window in buffer "buf". @@ -2625,25 +2630,27 @@ static wininfo_T *find_wininfo(buf_T *buf, bool need_options, bool skip_diff_buf } } + if (wip != NULL) { + return wip; + } + // If no wininfo for curwin, use the first in the list (that doesn't have // 'diff' set and is in another tab page). // If "need_options" is true skip entries that don't have options set, // unless the window is editing "buf", so we can copy from the window // itself. - if (wip == NULL) { - if (skip_diff_buffer) { - for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) { - if (!wininfo_other_tab_diff(wip) - && (!need_options - || wip->wi_optset - || (wip->wi_win != NULL - && wip->wi_win->w_buffer == buf))) { - break; - } + if (skip_diff_buffer) { + for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) { + if (!wininfo_other_tab_diff(wip) + && (!need_options + || wip->wi_optset + || (wip->wi_win != NULL + && wip->wi_win->w_buffer == buf))) { + break; } - } else { - wip = buf->b_wininfo; } + } else { + wip = buf->b_wininfo; } return wip; } diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index 761e915131..2952d631e4 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -1585,21 +1585,24 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons case CMD_dsplit: // Skip count. arg = (const char *)skipwhite(skipdigits(arg)); - if (*arg == '/') { // Match regexp, not just whole words. - for (++arg; *arg && *arg != '/'; arg++) { - if (*arg == '\\' && arg[1] != NUL) { - arg++; - } + if (*arg != '/') { + return NULL; + } + + // Match regexp, not just whole words. + for (++arg; *arg && *arg != '/'; arg++) { + if (*arg == '\\' && arg[1] != NUL) { + arg++; } - if (*arg) { - arg = (const char *)skipwhite(arg + 1); + } + if (*arg) { + arg = (const char *)skipwhite(arg + 1); - // Check for trailing illegal characters. - if (*arg == NUL || strchr("|\"\n", *arg) == NULL) { - xp->xp_context = EXPAND_NOTHING; - } else { - return arg; - } + // Check for trailing illegal characters. + if (*arg == NUL || strchr("|\"\n", *arg) == NULL) { + xp->xp_context = EXPAND_NOTHING; + } else { + return arg; } } break; diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c index 3af8f8902d..3dfbcd1f81 100644 --- a/src/nvim/debugger.c +++ b/src/nvim/debugger.c @@ -317,13 +317,15 @@ static int get_maxbacktrace_level(char *sname) { int maxbacktrace = 0; - if (sname != NULL) { - char *p = sname; - char *q; - while ((q = strstr(p, "..")) != NULL) { - p = q + 2; - maxbacktrace++; - } + if (sname == NULL) { + return 0; + } + + char *p = sname; + char *q; + while ((q = strstr(p, "..")) != NULL) { + p = q + 2; + maxbacktrace++; } return maxbacktrace; } @@ -458,20 +460,21 @@ void dbg_check_breakpoint(exarg_T *eap) /// @return true when the debug mode is entered this time. bool dbg_check_skipped(exarg_T *eap) { - if (debug_skipped) { - // Save the value of got_int and reset it. We don't want a previous - // interruption cause flushing the input buffer. - int prev_got_int = got_int; - got_int = false; - debug_breakpoint_name = debug_skipped_name; - // eap->skip is true - eap->skip = false; - dbg_check_breakpoint(eap); - eap->skip = true; - got_int |= prev_got_int; - return true; - } - return false; + if (!debug_skipped) { + return false; + } + + // Save the value of got_int and reset it. We don't want a previous + // interruption cause flushing the input buffer. + int prev_got_int = got_int; + got_int = false; + debug_breakpoint_name = debug_skipped_name; + // eap->skip is true + eap->skip = false; + dbg_check_breakpoint(eap); + eap->skip = true; + got_int |= prev_got_int; + return true; } static garray_T dbg_breakp = { 0, 0, sizeof(struct debuggy), 4, NULL }; diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index dc85b39684..744520149f 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1528,30 +1528,31 @@ int get_digraph(bool cmdline) no_mapping--; allow_keys--; - if (c != ESC) { - // ESC cancels CTRL-K - if (IS_SPECIAL(c)) { - // insert special key code - return c; - } + if (c == ESC) { // ESC cancels CTRL-K + return NUL; + } - if (cmdline) { - if ((char2cells(c) == 1) && c < 128 && (cmdline_star == 0)) { - putcmdline((char)c, true); - } - } else { - add_to_showcmd(c); - } - no_mapping++; - allow_keys++; - int cc = plain_vgetc(); - no_mapping--; - allow_keys--; - - if (cc != ESC) { - // ESC cancels CTRL-K - return digraph_get(c, cc, true); + if (IS_SPECIAL(c)) { + // insert special key code + return c; + } + + if (cmdline) { + if ((char2cells(c) == 1) && c < 128 && (cmdline_star == 0)) { + putcmdline((char)c, true); } + } else { + add_to_showcmd(c); + } + no_mapping++; + allow_keys++; + int cc = plain_vgetc(); + no_mapping--; + allow_keys--; + + if (cc != ESC) { + // ESC cancels CTRL-K + return digraph_get(c, cc, true); } return NUL; } diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 5cb4dc2631..180723f412 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -859,14 +859,14 @@ static void f_cindent(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) win_T *get_optional_window(typval_T *argvars, int idx) { - win_T *win = curwin; + if (argvars[idx].v_type == VAR_UNKNOWN) { + return curwin; + } - if (argvars[idx].v_type != VAR_UNKNOWN) { - win = find_win_by_nr_or_id(&argvars[idx]); - if (win == NULL) { - emsg(_(e_invalwindow)); - return NULL; - } + win_T *win = find_win_by_nr_or_id(&argvars[idx]); + if (win == NULL) { + emsg(_(e_invalwindow)); + return NULL; } return win; } @@ -6109,55 +6109,57 @@ static int get_search_arg(typval_T *varp, int *flagsp) { int dir = FORWARD; - if (varp->v_type != VAR_UNKNOWN) { - char nbuf[NUMBUFLEN]; - const char *flags = tv_get_string_buf_chk(varp, nbuf); - if (flags == NULL) { - return 0; // Type error; errmsg already given. - } - int mask; - while (*flags != NUL) { - switch (*flags) { - case 'b': - dir = BACKWARD; break; - case 'w': - p_ws = true; break; - case 'W': - p_ws = false; break; - default: - mask = 0; - if (flagsp != NULL) { - switch (*flags) { - case 'c': - mask = SP_START; break; - case 'e': - mask = SP_END; break; - case 'm': - mask = SP_RETCOUNT; break; - case 'n': - mask = SP_NOMOVE; break; - case 'p': - mask = SP_SUBPAT; break; - case 'r': - mask = SP_REPEAT; break; - case 's': - mask = SP_SETPCMARK; break; - case 'z': - mask = SP_COLUMN; break; - } - } - if (mask == 0) { - semsg(_(e_invarg2), flags); - dir = 0; - } else { - *flagsp |= mask; + if (varp->v_type == VAR_UNKNOWN) { + return FORWARD; + } + + char nbuf[NUMBUFLEN]; + const char *flags = tv_get_string_buf_chk(varp, nbuf); + if (flags == NULL) { + return 0; // Type error; errmsg already given. + } + int mask; + while (*flags != NUL) { + switch (*flags) { + case 'b': + dir = BACKWARD; break; + case 'w': + p_ws = true; break; + case 'W': + p_ws = false; break; + default: + mask = 0; + if (flagsp != NULL) { + switch (*flags) { + case 'c': + mask = SP_START; break; + case 'e': + mask = SP_END; break; + case 'm': + mask = SP_RETCOUNT; break; + case 'n': + mask = SP_NOMOVE; break; + case 'p': + mask = SP_SUBPAT; break; + case 'r': + mask = SP_REPEAT; break; + case 's': + mask = SP_SETPCMARK; break; + case 'z': + mask = SP_COLUMN; break; } } - if (dir == 0) { - break; + if (mask == 0) { + semsg(_(e_invarg2), flags); + dir = 0; + } else { + *flagsp |= mask; } - flags++; } + if (dir == 0) { + break; + } + flags++; } return dir; } diff --git a/src/nvim/eval/window.c b/src/nvim/eval/window.c index 14b3d7c909..50b25378e4 100644 --- a/src/nvim/eval/window.c +++ b/src/nvim/eval/window.c @@ -46,31 +46,33 @@ static int win_getid(typval_T *argvars) } int winnr = (int)tv_get_number(&argvars[0]); win_T *wp; - if (winnr > 0) { - if (argvars[1].v_type == VAR_UNKNOWN) { + if (winnr <= 0) { + return 0; + } + + if (argvars[1].v_type == VAR_UNKNOWN) { + wp = firstwin; + } else { + tabpage_T *tp = NULL; + int tabnr = (int)tv_get_number(&argvars[1]); + FOR_ALL_TABS(tp2) { + if (--tabnr == 0) { + tp = tp2; + break; + } + } + if (tp == NULL) { + return -1; + } + if (tp == curtab) { wp = firstwin; } else { - tabpage_T *tp = NULL; - int tabnr = (int)tv_get_number(&argvars[1]); - FOR_ALL_TABS(tp2) { - if (--tabnr == 0) { - tp = tp2; - break; - } - } - if (tp == NULL) { - return -1; - } - if (tp == curtab) { - wp = firstwin; - } else { - wp = tp->tp_firstwin; - } + wp = tp->tp_firstwin; } - for (; wp != NULL; wp = wp->w_next) { - if (--winnr == 0) { - return wp->handle; - } + } + for (; wp != NULL; wp = wp->w_next) { + if (--winnr == 0) { + return wp->handle; } } return 0; @@ -288,16 +290,18 @@ static int get_winnr(tabpage_T *tp, typval_T *argvar) } } - if (nr > 0) { - for (win_T *wp = (tp == curtab) ? firstwin : tp->tp_firstwin; - wp != twin; wp = wp->w_next) { - if (wp == NULL) { - // didn't find it in this tabpage - nr = 0; - break; - } - nr++; + if (nr <= 0) { + return 0; + } + + for (win_T *wp = (tp == curtab) ? firstwin : tp->tp_firstwin; + wp != twin; wp = wp->w_next) { + if (wp == NULL) { + // didn't find it in this tabpage + nr = 0; + break; } + nr++; } return nr; } diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 8861d0e7e3..f6e5d5c665 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4510,32 +4510,30 @@ void free_old_sub(void) /// @return true when it was created. bool prepare_tagpreview(bool undo_sync) { + if (curwin->w_p_pvw) { + return false; + } + // If there is already a preview window open, use that one. - if (!curwin->w_p_pvw) { - bool found_win = false; - FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { - if (wp->w_p_pvw) { - win_enter(wp, undo_sync); - found_win = true; - break; - } - } - if (!found_win) { - // There is no preview window open yet. Create one. - if (win_split(g_do_tagpreview > 0 ? g_do_tagpreview : 0, 0) - == FAIL) { - return false; - } - curwin->w_p_pvw = true; - curwin->w_p_wfh = true; - RESET_BINDING(curwin); // don't take over 'scrollbind' and 'cursorbind' - curwin->w_p_diff = false; // no 'diff' - set_string_option_direct("fdc", -1, // no 'foldcolumn' - "0", OPT_FREE, SID_NONE); - return true; + FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { + if (wp->w_p_pvw) { + win_enter(wp, undo_sync); + return false; } } - return false; + + // There is no preview window open yet. Create one. + if (win_split(g_do_tagpreview > 0 ? g_do_tagpreview : 0, 0) + == FAIL) { + return false; + } + curwin->w_p_pvw = true; + curwin->w_p_wfh = true; + RESET_BINDING(curwin); // don't take over 'scrollbind' and 'cursorbind' + curwin->w_p_diff = false; // no 'diff' + set_string_option_direct("fdc", -1, // no 'foldcolumn' + "0", OPT_FREE, SID_NONE); + return true; } /// Shows the effects of the :substitute command being typed ('inccommand'). diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 93d137eab9..93c5d24c0d 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4083,12 +4083,14 @@ static char *get_cmdline_completion(void) } CmdlineInfo *p = get_ccline_ptr(); - if (p != NULL && p->xpc != NULL) { - set_expand_context(p->xpc); - char *cmd_compl = get_user_cmd_complete(p->xpc, p->xpc->xp_context); - if (cmd_compl != NULL) { - return xstrdup(cmd_compl); - } + if (p == NULL || p->xpc == NULL) { + return NULL; + } + + set_expand_context(p->xpc); + char *cmd_compl = get_user_cmd_complete(p->xpc, p->xpc->xp_context); + if (cmd_compl != NULL) { + return xstrdup(cmd_compl); } return NULL; diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 4ac96cdfd2..6cb9e5c38d 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -481,7 +481,7 @@ void foldCheckClose(void) return; } - // can only be "all" right now + // 'foldclose' can only be "all" right now checkupdate(curwin); if (checkCloseRec(&curwin->w_folds, curwin->w_cursor.lnum, (int)curwin->w_p_fdl)) { diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 46a6352bc1..59ffff40a6 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1549,34 +1549,37 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg if (got_int) { return false; } - if (type == LIST_STRING ? (sarg != NULL) : (iarg != 0)) { - const char *ts = buf; - if (type == LIST_INT) { - snprintf((char *)buf, sizeof(buf), "%d", iarg - 1); - } else if (type == LIST_STRING) { - ts = sarg; - } else { // type == LIST_ATTR - buf[0] = NUL; - for (int i = 0; hl_attr_table[i] != 0; i++) { - if (iarg & hl_attr_table[i]) { - if (buf[0] != NUL) { - xstrlcat(buf, ",", 100); - } - xstrlcat(buf, hl_name_table[i], 100); - iarg &= ~hl_attr_table[i]; // don't want "inverse" + + if (type == LIST_STRING ? (sarg == NULL) : (iarg == 0)) { + return didh; + } + + const char *ts = buf; + if (type == LIST_INT) { + snprintf((char *)buf, sizeof(buf), "%d", iarg - 1); + } else if (type == LIST_STRING) { + ts = sarg; + } else { // type == LIST_ATTR + buf[0] = NUL; + for (int i = 0; hl_attr_table[i] != 0; i++) { + if (iarg & hl_attr_table[i]) { + if (buf[0] != NUL) { + xstrlcat(buf, ",", 100); } + xstrlcat(buf, hl_name_table[i], 100); + iarg &= ~hl_attr_table[i]; // don't want "inverse" } } + } - (void)syn_list_header(didh, vim_strsize((char *)ts) + (int)strlen(name) + 1, id, false); - didh = true; - if (!got_int) { - if (*name != NUL) { - msg_puts_attr(name, HL_ATTR(HLF_D)); - msg_puts_attr("=", HL_ATTR(HLF_D)); - } - msg_outtrans((char *)ts); + (void)syn_list_header(didh, vim_strsize((char *)ts) + (int)strlen(name) + 1, id, false); + didh = true; + if (!got_int) { + if (*name != NUL) { + msg_puts_attr(name, HL_ATTR(HLF_D)); + msg_puts_attr("=", HL_ATTR(HLF_D)); } + msg_outtrans((char *)ts); } return didh; } @@ -2125,36 +2128,44 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg) include_link = 2; include_default = 1; + if (*arg == NUL) { + return; + } + // (part of) subcommand already typed - if (*arg != NUL) { - const char *p = (const char *)skiptowhite(arg); - if (*p != NUL) { // Past "default" or group name. - include_default = 0; - if (strncmp("default", arg, (unsigned)(p - arg)) == 0) { - arg = (const char *)skipwhite(p); - xp->xp_pattern = (char *)arg; - p = (const char *)skiptowhite(arg); - } - if (*p != NUL) { // past group name - include_link = 0; - if (arg[1] == 'i' && arg[0] == 'N') { - highlight_list(); - } - if (strncmp("link", arg, (unsigned)(p - arg)) == 0 - || strncmp("clear", arg, (unsigned)(p - arg)) == 0) { - xp->xp_pattern = skipwhite(p); - p = (const char *)skiptowhite(xp->xp_pattern); - if (*p != NUL) { // Past first group name. - xp->xp_pattern = skipwhite(p); - p = (const char *)skiptowhite(xp->xp_pattern); - } - } - if (*p != NUL) { // Past group name(s). - xp->xp_context = EXPAND_NOTHING; - } - } + const char *p = (const char *)skiptowhite(arg); + if (*p == NUL) { + return; + } + + // past "default" or group name + include_default = 0; + if (strncmp("default", arg, (unsigned)(p - arg)) == 0) { + arg = (const char *)skipwhite(p); + xp->xp_pattern = (char *)arg; + p = (const char *)skiptowhite(arg); + } + if (*p == NUL) { + return; + } + + // past group name + include_link = 0; + if (arg[1] == 'i' && arg[0] == 'N') { + highlight_list(); + } + if (strncmp("link", arg, (unsigned)(p - arg)) == 0 + || strncmp("clear", arg, (unsigned)(p - arg)) == 0) { + xp->xp_pattern = skipwhite(p); + p = (const char *)skiptowhite(xp->xp_pattern); + if (*p != NUL) { // past first group name + xp->xp_pattern = skipwhite(p); + p = (const char *)skiptowhite(xp->xp_pattern); } } + if (*p != NUL) { // past group name(s) + xp->xp_context = EXPAND_NOTHING; + } } /// List highlighting matches in a nice way. diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 0198649d28..64844a510f 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -356,6 +356,7 @@ bool cin_islabel(void) // XXX if (cin_isscopedecl((char_u *)s)) { return false; } + if (!cin_islabel_skip(&s)) { return false; } |