vim-patch:8.1.2394: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
63d9e730f7
This commit is contained in:
Dundar Göc
2021-10-20 21:14:31 +02:00
parent ce441b8b13
commit daf670dde6
4 changed files with 188 additions and 184 deletions

View File

@@ -461,8 +461,8 @@ static int toggle_Magic(int x)
*/ */
#define UCHARAT(p) ((int)*(char_u *)(p)) #define UCHARAT(p) ((int)*(char_u *)(p))
/* Used for an error (down from) vim_regcomp(): give the error message, set // Used for an error (down from) vim_regcomp(): give the error message, set
* rc_did_emsg and return NULL */ // rc_did_emsg and return NULL
#define EMSG_RET_NULL(m) return (EMSG(m), rc_did_emsg = true, (void *)NULL) #define EMSG_RET_NULL(m) return (EMSG(m), rc_did_emsg = true, (void *)NULL)
#define IEMSG_RET_NULL(m) return (IEMSG(m), rc_did_emsg = true, (void *)NULL) #define IEMSG_RET_NULL(m) return (IEMSG(m), rc_did_emsg = true, (void *)NULL)
#define EMSG_RET_FAIL(m) return (EMSG(m), rc_did_emsg = true, FAIL) #define EMSG_RET_FAIL(m) return (EMSG(m), rc_did_emsg = true, FAIL)
@@ -715,9 +715,9 @@ static int reg_magic; /* magicness of the pattern: */
#define MAGIC_ON 3 /* "\m" or 'magic' */ #define MAGIC_ON 3 /* "\m" or 'magic' */
#define MAGIC_ALL 4 /* "\v" very magic */ #define MAGIC_ALL 4 /* "\v" very magic */
static int reg_string; /* matching with a string instead of a buffer static int reg_string; // matching with a string instead of a buffer
line */ // line
static int reg_strict; /* "[abc" is illegal */ static int reg_strict; // "[abc" is illegal
/* /*
* META contains all characters that may be magic, except '^' and '$'. * META contains all characters that may be magic, except '^' and '$'.
@@ -741,10 +741,10 @@ static char_u META_flags[] = {
1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1
}; };
static int curchr; /* currently parsed character */ static int curchr; // currently parsed character
/* Previous character. Note: prevchr is sometimes -1 when we are not at the // Previous character. Note: prevchr is sometimes -1 when we are not at the
* start, eg in /[ ^I]^ the pattern was never found even if it existed, // start, eg in /[ ^I]^ the pattern was never found even if it existed,
* because ^ was taken to be magic -- webb */ // because ^ was taken to be magic -- webb
static int prevchr; static int prevchr;
static int prevprevchr; /* previous-previous character */ static int prevprevchr; /* previous-previous character */
static int nextchr; /* used for ungetchr() */ static int nextchr; /* used for ungetchr() */
@@ -2835,21 +2835,22 @@ static int peekchr(void)
curchr = Magic(curchr); curchr = Magic(curchr);
break; break;
case '*': case '*':
/* * is not magic as the very first character, eg "?*ptr", when // * is not magic as the very first character, eg "?*ptr", when
* after '^', eg "/^*ptr" and when after "\(", "\|", "\&". But // after '^', eg "/^*ptr" and when after "\(", "\|", "\&". But
* "\(\*" is not magic, thus must be magic if "after_slash" */ // "\(\*" is not magic, thus must be magic if "after_slash"
if (reg_magic >= MAGIC_ON if (reg_magic >= MAGIC_ON
&& !at_start && !at_start
&& !(prev_at_start && prevchr == Magic('^')) && !(prev_at_start && prevchr == Magic('^'))
&& (after_slash && (after_slash
|| (prevchr != Magic('(') || (prevchr != Magic('(')
&& prevchr != Magic('&') && prevchr != Magic('&')
&& prevchr != Magic('|')))) && prevchr != Magic('|')))) {
curchr = Magic('*'); curchr = Magic('*');
}
break; break;
case '^': case '^':
/* '^' is only magic as the very first character and if it's after // '^' is only magic as the very first character and if it's after
* "\(", "\|", "\&' or "\n" */ // "\(", "\|", "\&' or "\n"
if (reg_magic >= MAGIC_OFF if (reg_magic >= MAGIC_OFF
&& (at_start && (at_start
|| reg_magic == MAGIC_ALL || reg_magic == MAGIC_ALL
@@ -2865,8 +2866,8 @@ static int peekchr(void)
} }
break; break;
case '$': case '$':
/* '$' is only magic as the very last char and if it's in front of // '$' is only magic as the very last char and if it's in front of
* either "\|", "\)", "\&", or "\n" */ // either "\|", "\)", "\&", or "\n"
if (reg_magic >= MAGIC_OFF) { if (reg_magic >= MAGIC_OFF) {
char_u *p = regparse + 1; char_u *p = regparse + 1;
bool is_magic_all = (reg_magic == MAGIC_ALL); bool is_magic_all = (reg_magic == MAGIC_ALL);
@@ -5811,8 +5812,8 @@ static int match_with_backref(linenr_T start_lnum, colnr_T start_col, linenr_T e
if (bytelen != NULL) if (bytelen != NULL)
*bytelen = 0; *bytelen = 0;
for (;; ) { for (;; ) {
/* Since getting one line may invalidate the other, need to make copy. // Since getting one line may invalidate the other, need to make copy.
* Slow! */ // Slow!
if (rex.line != reg_tofree) { if (rex.line != reg_tofree) {
len = (int)STRLEN(rex.line); len = (int)STRLEN(rex.line);
if (reg_tofree == NULL || len >= (int)reg_tofreelen) { if (reg_tofree == NULL || len >= (int)reg_tofreelen) {
@@ -6445,9 +6446,9 @@ static int cstrncmp(char_u *s1, char_u *s2, int *n)
return result; return result;
} }
/*************************************************************** ////////////////////////////////////////////////////////////////
* regsub stuff * // regsub stuff //
***************************************************************/ ////////////////////////////////////////////////////////////////
/* This stuff below really confuses cc on an SGI -- webb */ /* This stuff below really confuses cc on an SGI -- webb */
@@ -6512,9 +6513,10 @@ char_u *regtilde(char_u *source, int magic)
memmove(tmpsub, newsub, (size_t)len); memmove(tmpsub, newsub, (size_t)len);
/* interpret tilde */ /* interpret tilde */
memmove(tmpsub + len, reg_prev_sub, (size_t)prevlen); memmove(tmpsub + len, reg_prev_sub, (size_t)prevlen);
/* copy postfix */ // copy postfix
if (!magic) if (!magic) {
++p; /* back off \ */ p++; // back off backslash
}
STRCPY(tmpsub + len + prevlen, p + 1); STRCPY(tmpsub + len + prevlen, p + 1);
if (newsub != source) /* already allocated newsub */ if (newsub != source) /* already allocated newsub */

View File

@@ -48,14 +48,14 @@ enum {
NFA_MATCH, NFA_MATCH,
NFA_EMPTY, /* matches 0-length */ NFA_EMPTY, /* matches 0-length */
NFA_START_COLL, /* [abc] start */ NFA_START_COLL, // [abc] start
NFA_END_COLL, /* [abc] end */ NFA_END_COLL, // [abc] end
NFA_START_NEG_COLL, /* [^abc] start */ NFA_START_NEG_COLL, // [^abc] start
NFA_END_NEG_COLL, /* [^abc] end (postfix only) */ NFA_END_NEG_COLL, // [^abc] end (postfix only)
NFA_RANGE, /* range of the two previous items NFA_RANGE, // range of the two previous items
* (postfix only) */ // (postfix only)
NFA_RANGE_MIN, /* low end of a range */ NFA_RANGE_MIN, // low end of a range
NFA_RANGE_MAX, /* high end of a range */ NFA_RANGE_MAX, // high end of a range
NFA_CONCAT, // concatenate two previous items (postfix NFA_CONCAT, // concatenate two previous items (postfix
// only) // only)
@@ -88,9 +88,9 @@ enum {
NFA_END_INVISIBLE, NFA_END_INVISIBLE,
NFA_END_INVISIBLE_NEG, NFA_END_INVISIBLE_NEG,
NFA_END_PATTERN, NFA_END_PATTERN,
NFA_COMPOSING, /* Next nodes in NFA are part of the NFA_COMPOSING, // Next nodes in NFA are part of the
composing multibyte char */ // composing multibyte char
NFA_END_COMPOSING, /* End of a composing char in the NFA */ NFA_END_COMPOSING, // End of a composing char in the NFA
NFA_ANY_COMPOSING, // \%C: Any composing characters. NFA_ANY_COMPOSING, // \%C: Any composing characters.
NFA_OPT_CHARS, /* \%[abc] */ NFA_OPT_CHARS, /* \%[abc] */
@@ -256,9 +256,9 @@ static char_u e_ill_char_class[] = N_(
"E877: (NFA regexp) Invalid character class: %" PRId64); "E877: (NFA regexp) Invalid character class: %" PRId64);
static char_u e_value_too_large[] = N_("E951: \\% value too large"); static char_u e_value_too_large[] = N_("E951: \\% value too large");
/* Since the out pointers in the list are always // Since the out pointers in the list are always
* uninitialized, we use the pointers themselves // uninitialized, we use the pointers themselves
* as storage for the Ptrlists. */ // as storage for the Ptrlists.
typedef union Ptrlist Ptrlist; typedef union Ptrlist Ptrlist;
union Ptrlist { union Ptrlist {
Ptrlist *next; Ptrlist *next;
@@ -310,9 +310,9 @@ struct nfa_pim_S {
typedef struct { typedef struct {
nfa_state_T *state; nfa_state_T *state;
int count; int count;
nfa_pim_T pim; /* if pim.result != NFA_PIM_UNUSED: postponed nfa_pim_T pim; // if pim.result != NFA_PIM_UNUSED: postponed
* invisible match */ // invisible match
regsubs_T subs; /* submatch info, only party used */ regsubs_T subs; // submatch info, only party used
} nfa_thread_T; } nfa_thread_T;
// nfa_list_T contains the alternative NFA execution states. // nfa_list_T contains the alternative NFA execution states.
@@ -1675,13 +1675,13 @@ collection:
} }
/* Try collating class like [. .] */ /* Try collating class like [. .] */
if (collclass != 0) { if (collclass != 0) {
startc = collclass; /* allow [.a.]-x as a range */ startc = collclass; // allow [.a.]-x as a range
/* Will emit the proper atom at the end of the // Will emit the proper atom at the end of the
* while loop. */ // while loop.
} }
} }
/* Try a range like 'a-x' or '\t-z'. Also allows '-' as a // Try a range like 'a-x' or '\t-z'. Also allows '-' as a
* start character. */ // start character.
if (*regparse == '-' && oldstartc != -1) { if (*regparse == '-' && oldstartc != -1) {
emit_range = true; emit_range = true;
startc = oldstartc; startc = oldstartc;
@@ -1689,11 +1689,10 @@ collection:
continue; // reading the end of the range continue; // reading the end of the range
} }
/* Now handle simple and escaped characters. // Now handle simple and escaped characters.
* Only "\]", "\^", "\]" and "\\" are special in Vi. Vim // Only "\]", "\^", "\]" and "\\" are special in Vi. Vim
* accepts "\t", "\e", etc., but only when the 'l' flag in // accepts "\t", "\e", etc., but only when the 'l' flag in
* 'cpoptions' is not included. // 'cpoptions' is not included.
*/
if (*regparse == '\\' if (*regparse == '\\'
&& regparse + 1 <= endp && regparse + 1 <= endp
&& (vim_strchr(REGEXP_INRANGE, regparse[1]) != NULL && (vim_strchr(REGEXP_INRANGE, regparse[1]) != NULL
@@ -1736,13 +1735,14 @@ collection:
} }
if (endc > startc + 2) { if (endc > startc + 2) {
/* Emit a range instead of the sequence of // Emit a range instead of the sequence of
* individual characters. */ // individual characters.
if (startc == 0) if (startc == 0) {
/* \x00 is translated to \x0a, start at \x01. */ // \x00 is translated to \x0a, start at \x01.
EMIT(1); EMIT(1);
else } else {
--post_ptr; /* remove NFA_CONCAT */ post_ptr--; // remove NFA_CONCAT
}
EMIT(endc); EMIT(endc);
EMIT(NFA_RANGE); EMIT(NFA_RANGE);
EMIT(NFA_CONCAT); EMIT(NFA_CONCAT);
@@ -1755,8 +1755,8 @@ collection:
EMIT(NFA_CONCAT); EMIT(NFA_CONCAT);
} }
} else { } else {
/* Emit the range. "startc" was already emitted, so // Emit the range. "startc" was already emitted, so
* skip it. */ // skip it.
for (c = startc + 1; c <= endc; c++) { for (c = startc + 1; c <= endc; c++) {
EMIT(c); EMIT(c);
EMIT(NFA_CONCAT); EMIT(NFA_CONCAT);
@@ -1765,19 +1765,20 @@ collection:
emit_range = false; emit_range = false;
startc = -1; startc = -1;
} else { } else {
/* This char (startc) is not part of a range. Just // This char (startc) is not part of a range. Just
* emit it. // emit it.
* Normally, simply emit startc. But if we get char // Normally, simply emit startc. But if we get char
* code=0 from a collating char, then replace it with // code=0 from a collating char, then replace it with
* 0x0a. // 0x0a.
* This is needed to completely mimic the behaviour of // This is needed to completely mimic the behaviour of
* the backtracking engine. */ // the backtracking engine.
if (startc == NFA_NEWL) { if (startc == NFA_NEWL) {
/* Line break can't be matched as part of the // Line break can't be matched as part of the
* collection, add an OR below. But not for negated // collection, add an OR below. But not for negated
* range. */ // range.
if (!negated) if (!negated) {
extra = NFA_ADD_NL; extra = NFA_ADD_NL;
}
} else { } else {
if (got_coll_char == true && startc == 0) { if (got_coll_char == true && startc == 0) {
EMIT(0x0a); EMIT(0x0a);
@@ -1831,14 +1832,14 @@ nfa_do_multibyte:
|| utf_iscomposing(c)) { || utf_iscomposing(c)) {
int i = 0; int i = 0;
/* A base character plus composing characters, or just one // A base character plus composing characters, or just one
* or more composing characters. // or more composing characters.
* This requires creating a separate atom as if enclosing // This requires creating a separate atom as if enclosing
* the characters in (), where NFA_COMPOSING is the ( and // the characters in (), where NFA_COMPOSING is the ( and
* NFA_END_COMPOSING is the ). Note that right now we are // NFA_END_COMPOSING is the ). Note that right now we are
* building the postfix form, not the NFA itself; // building the postfix form, not the NFA itself;
* a composing char could be: a, b, c, NFA_COMPOSING // a composing char could be: a, b, c, NFA_COMPOSING
* where 'b' and 'c' are chars with codes > 256. */ // where 'b' and 'c' are chars with codes > 256. */
for (;; ) { for (;; ) {
EMIT(c); EMIT(c);
if (i > 0) if (i > 0)
@@ -3109,9 +3110,9 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
case NFA_END_COLL: case NFA_END_COLL:
case NFA_END_NEG_COLL: case NFA_END_NEG_COLL:
/* On the stack is the sequence starting with NFA_START_COLL or // On the stack is the sequence starting with NFA_START_COLL or
* NFA_START_NEG_COLL and all possible characters. Patch it to // NFA_START_NEG_COLL and all possible characters. Patch it to
* add the output to the start. */ // add the output to the start.
if (nfa_calc_size == true) { if (nfa_calc_size == true) {
nstate++; nstate++;
break; break;
@@ -3233,12 +3234,12 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
if (before) if (before)
n = *++p; /* get the count */ n = *++p; /* get the count */
/* The \@= operator: match the preceding atom with zero width. // The \@= operator: match the preceding atom with zero width.
* The \@! operator: no match for the preceding atom. // The \@! operator: no match for the preceding atom.
* The \@<= operator: match for the preceding atom. // The \@<= operator: match for the preceding atom.
* The \@<! operator: no match for the preceding atom. // The \@<! operator: no match for the preceding atom.
* Surrounds the preceding atom with START_INVISIBLE and // Surrounds the preceding atom with START_INVISIBLE and
* END_INVISIBLE, similarly to MOPEN. */ // END_INVISIBLE, similarly to MOPEN.
if (nfa_calc_size == true) { if (nfa_calc_size == true) {
nstate += pattern ? 4 : 2; nstate += pattern ? 4 : 2;
@@ -3269,11 +3270,12 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
patch(e.out, s1); patch(e.out, s1);
PUSH(frag(s, list1(&s1->out))); PUSH(frag(s, list1(&s1->out)));
if (before) { if (before) {
if (n <= 0) if (n <= 0) {
/* See if we can guess the maximum width, it avoids a // See if we can guess the maximum width, it avoids a
* lot of pointless tries. */ // lot of pointless tries.
n = nfa_max_width(e.start, 0); n = nfa_max_width(e.start, 0);
s->val = n; /* store the count */ }
s->val = n; // store the count
} }
} }
break; break;
@@ -3516,8 +3518,8 @@ static void nfa_postprocess(nfa_regprog_T *prog)
directly = ch_follows * 10 < ch_invisible; directly = ch_follows * 10 < ch_invisible;
} }
} else { } else {
/* normal invisible, first do the one with the // normal invisible, first do the one with the
* highest failure chance */ // highest failure chance
directly = ch_follows < ch_invisible; directly = ch_follows < ch_invisible;
} }
} }
@@ -4012,8 +4014,8 @@ static regsubs_T *addstate(
case NFA_ZEND: case NFA_ZEND:
case NFA_SPLIT: case NFA_SPLIT:
case NFA_EMPTY: case NFA_EMPTY:
/* These nodes are not added themselves but their "out" and/or // These nodes are not added themselves but their "out" and/or
* "out1" may be added below. */ // "out1" may be added below.
break; break;
case NFA_BOL: case NFA_BOL:
@@ -4051,21 +4053,20 @@ static regsubs_T *addstate(
case NFA_ZOPEN9: case NFA_ZOPEN9:
case NFA_NOPEN: case NFA_NOPEN:
case NFA_ZSTART: case NFA_ZSTART:
/* These nodes need to be added so that we can bail out when it // These nodes need to be added so that we can bail out when it
* was added to this list before at the same position to avoid an // was added to this list before at the same position to avoid an
* endless loop for "\(\)*" */ // endless loop for "\(\)*"
default: default:
if (state->lastlist[nfa_ll_index] == l->id && state->c != NFA_SKIP) { if (state->lastlist[nfa_ll_index] == l->id && state->c != NFA_SKIP) {
/* This state is already in the list, don't add it again, // This state is already in the list, don't add it again,
* unless it is an MOPEN that is used for a backreference or // unless it is an MOPEN that is used for a backreference or
* when there is a PIM. For NFA_MATCH check the position, // when there is a PIM. For NFA_MATCH check the position,
* lower position is preferred. */ // lower position is preferred.
if (!rex.nfa_has_backref && pim == NULL && !l->has_pim if (!rex.nfa_has_backref && pim == NULL && !l->has_pim
&& state->c != NFA_MATCH) { && state->c != NFA_MATCH) {
// When called from addstate_here() do insert before
/* When called from addstate_here() do insert before // existing states.
* existing states. */
if (add_here) { if (add_here) {
for (k = 0; k < l->n && k < listindex; ++k) { for (k = 0; k < l->n && k < listindex; ++k) {
if (l->t[k].state->id == state->id) { if (l->t[k].state->id == state->id) {
@@ -4088,11 +4089,12 @@ skip_add:
} }
} }
/* Do not add the state again when it exists with the same // Do not add the state again when it exists with the same
* positions. */ // positions.
if (has_state_with_pos(l, state, subs, pim)) if (has_state_with_pos(l, state, subs, pim)) {
goto skip_add; goto skip_add;
} }
}
// When there are backreferences or PIMs the number of states may // When there are backreferences or PIMs the number of states may
// be (a lot) bigger than anticipated. // be (a lot) bigger than anticipated.
@@ -4362,9 +4364,9 @@ static regsubs_T *addstate_here(
int count; int count;
int listidx = *ip; int listidx = *ip;
/* First add the state(s) at the end, so that we know how many there are. // First add the state(s) at the end, so that we know how many there are.
* Pass the listidx as offset (avoids adding another argument to // Pass the listidx as offset (avoids adding another argument to
* addstate(). */ // addstate().
regsubs_T *r = addstate(l, state, subs, pim, -listidx - ADDSTATE_HERE_OFFSET); regsubs_T *r = addstate(l, state, subs, pim, -listidx - ADDSTATE_HERE_OFFSET);
if (r == NULL) { if (r == NULL) {
return NULL; return NULL;
@@ -4385,8 +4387,8 @@ static regsubs_T *addstate_here(
l->t[listidx] = l->t[l->n - 1]; l->t[listidx] = l->t[l->n - 1];
} else if (count > 1) { } else if (count > 1) {
if (l->n + count - 1 >= l->len) { if (l->n + count - 1 >= l->len) {
/* not enough space to move the new states, reallocate the list // not enough space to move the new states, reallocate the list
* and move the states to the right position */ // and move the states to the right position
const int newlen = l->len * 3 / 2 + 50; const int newlen = l->len * 3 / 2 + 50;
const size_t newsize = newlen * sizeof(nfa_thread_T); const size_t newsize = newlen * sizeof(nfa_thread_T);
@@ -4408,8 +4410,8 @@ static regsubs_T *addstate_here(
xfree(l->t); xfree(l->t);
l->t = newl; l->t = newl;
} else { } else {
/* make space for new states, then move them from the // make space for new states, then move them from the
* end to the current position */ // end to the current position
memmove(&(l->t[listidx + count]), memmove(&(l->t[listidx + count]),
&(l->t[listidx + 1]), &(l->t[listidx + 1]),
sizeof(nfa_thread_T) * (l->n - listidx - 1)); sizeof(nfa_thread_T) * (l->n - listidx - 1));
@@ -6582,10 +6584,11 @@ static long nfa_regexec_both(char_u *line, colnr_T startcol,
} }
if (prog->regstart != NUL) { if (prog->regstart != NUL) {
/* Skip ahead until a character we know the match must start with. // Skip ahead until a character we know the match must start with.
* When there is none there is no match. */ // When there is none there is no match.
if (skip_to_start(prog->regstart, &col) == FAIL) if (skip_to_start(prog->regstart, &col) == FAIL) {
return 0L; return 0L;
}
// If match_text is set it contains the full text that must match. // If match_text is set it contains the full text that must match.
// Nothing else to try. Doesn't handle combining chars well. // Nothing else to try. Doesn't handle combining chars well.

View File

@@ -694,7 +694,7 @@ void conceal_check_cursor_line(void)
if (curwin->w_p_cole > 0 && (conceal_cursor_used != should_conceal)) { if (curwin->w_p_cole > 0 && (conceal_cursor_used != should_conceal)) {
redrawWinline(curwin, curwin->w_cursor.lnum); redrawWinline(curwin, curwin->w_cursor.lnum);
// Need to recompute cursor column, e.g., when starting Visual mode // Need to recompute cursor column, e.g., when starting Visual mode
// without concealing. */ // without concealing.
curs_columns(curwin, true); curs_columns(curwin, true);
} }
} }
@@ -4827,8 +4827,8 @@ static void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol,
} }
if (clear_next) { if (clear_next) {
/* Clear the second half of a double-wide character of which the left // Clear the second half of a double-wide character of which the left
* half was overwritten with a single-wide character. */ // half was overwritten with a single-wide character.
schar_from_ascii(grid->chars[off_to], ' '); schar_from_ascii(grid->chars[off_to], ' ');
end_dirty++; end_dirty++;
} }
@@ -5175,9 +5175,9 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
} }
wild_menu_showing = WM_SCROLLED; wild_menu_showing = WM_SCROLLED;
} else { } else {
/* Create status line if needed by setting 'laststatus' to 2. // Create status line if needed by setting 'laststatus' to 2.
* Set 'winminheight' to zero to avoid that the window is // Set 'winminheight' to zero to avoid that the window is
* resized. */ // resized.
if (lastwin->w_status_height == 0) { if (lastwin->w_status_height == 0) {
save_p_ls = p_ls; save_p_ls = p_ls;
save_p_wmh = p_wmh; save_p_wmh = p_wmh;
@@ -7324,8 +7324,8 @@ void draw_tabline(void)
} }
} }
/* Reset the flag here again, in case evaluating 'tabline' causes it to be // Reset the flag here again, in case evaluating 'tabline' causes it to be
* set. */ // set.
redraw_tabline = false; redraw_tabline = false;
} }
@@ -7390,9 +7390,9 @@ int fillchar_status(int *attr, win_T *wp)
*attr = win_hl_attr(wp, HLF_SNC); *attr = win_hl_attr(wp, HLF_SNC);
fill = wp->w_p_fcs_chars.stlnc; fill = wp->w_p_fcs_chars.stlnc;
} }
/* Use fill when there is highlighting, and highlighting of current // Use fill when there is highlighting, and highlighting of current
* window differs, or the fillchars differ, or this is not the // window differs, or the fillchars differ, or this is not the
* current window */ // current window
if (*attr != 0 && ((win_hl_attr(wp, HLF_S) != win_hl_attr(wp, HLF_SNC) if (*attr != 0 && ((win_hl_attr(wp, HLF_S) != win_hl_attr(wp, HLF_SNC)
|| !is_curwin || ONE_WINDOW) || !is_curwin || ONE_WINDOW)
|| (wp->w_p_fcs_chars.stl != wp->w_p_fcs_chars.stlnc))) { || (wp->w_p_fcs_chars.stl != wp->w_p_fcs_chars.stlnc))) {

View File

@@ -699,8 +699,8 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
*/ */
if (vim_strchr(p_cpo, CPO_SEARCH) != NULL) { if (vim_strchr(p_cpo, CPO_SEARCH) != NULL) {
if (nmatched > 1) { if (nmatched > 1) {
/* end is in next line, thus no match in // end is in next line, thus no match in
* this line */ // this line
match_ok = false; match_ok = false;
break; break;
} }
@@ -758,10 +758,10 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
*/ */
match_ok = false; match_ok = false;
for (;; ) { for (;; ) {
/* Remember a position that is before the start // Remember a position that is before the start
* position, we use it if it's the last match in // position, we use it if it's the last match in
* the line. Always accept a position after // the line. Always accept a position after
* wrapping around. */ // wrapping around.
if (loop if (loop
|| ((options & SEARCH_END) || ((options & SEARCH_END)
? (lnum + regmatch.endpos[0].lnum ? (lnum + regmatch.endpos[0].lnum
@@ -890,9 +890,9 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
break; break;
} }
/* Cancel searching if a character was typed. Used for // Cancel searching if a character was typed. Used for
* 'incsearch'. Don't check too often, that would slowdown // 'incsearch'. Don't check too often, that would slowdown
* searching too much. */ // searching too much.
if ((options & SEARCH_PEEK) if ((options & SEARCH_PEEK)
&& ((lnum - pos->lnum) & 0x3f) == 0 && ((lnum - pos->lnum) & 0x3f) == 0
&& char_avail()) { && char_avail()) {
@@ -1082,8 +1082,8 @@ int do_search(oparg_T *oap, int dirc, int search_delim, char_u *pat, long count,
} }
} }
/* If the cursor is in a closed fold, don't find another match in the same // If the cursor is in a closed fold, don't find another match in the same
* fold. */ // fold.
if (dirc == '/') { if (dirc == '/') {
if (hasFolding(pos.lnum, NULL, &pos.lnum)) { if (hasFolding(pos.lnum, NULL, &pos.lnum)) {
pos.col = MAXCOL - 2; // avoid overflow when adding 1 pos.col = MAXCOL - 2; // avoid overflow when adding 1
@@ -1892,8 +1892,8 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
} else if (!cpo_bsl) { } else if (!cpo_bsl) {
int col, bslcnt = 0; int col, bslcnt = 0;
/* Set "match_escaped" if there are an odd number of // Set "match_escaped" if there are an odd number of
* backslashes. */ // backslashes.
for (col = pos.col; check_prevcol(linep, col, '\\', &col); ) { for (col = pos.col; check_prevcol(linep, col, '\\', &col); ) {
bslcnt++; bslcnt++;
} }
@@ -2033,8 +2033,8 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|| (lisp && comment_col != MAXCOL || (lisp && comment_col != MAXCOL
&& pos.col == (colnr_T)comment_col)) { && pos.col == (colnr_T)comment_col)) {
if (pos.lnum == curbuf->b_ml.ml_line_count // end of file if (pos.lnum == curbuf->b_ml.ml_line_count // end of file
/* line is exhausted and comment with it, // line is exhausted and comment with it,
* don't search for match in code */ // don't search for match in code
|| lispcomm) { || lispcomm) {
break; break;
} }
@@ -2271,8 +2271,8 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
break; break;
} }
/* Check for match outside of quotes, and inside of // Check for match outside of quotes, and inside of
* quotes when the start is also inside of quotes. */ // quotes when the start is also inside of quotes.
if ((!inquote || start_in_quotes == kTrue) if ((!inquote || start_in_quotes == kTrue)
&& (c == initc || c == findc)) { && (c == initc || c == findc)) {
int col, bslcnt = 0; int col, bslcnt = 0;
@@ -2340,8 +2340,8 @@ static int check_linecomment(const char_u *line)
} }
} else { } else {
while ((p = vim_strchr(p, '/')) != NULL) { while ((p = vim_strchr(p, '/')) != NULL) {
/* accept a double /, unless it's preceded with * and followed by *, // accept a double /, unless it's preceded with * and followed by *,
* because * / / * is an end and start of a C comment */ // because * / / * is an end and start of a C comment
if (p[1] == '/' && (p == line || p[-1] != '*' || p[2] != '*')) { if (p[1] == '/' && (p == line || p[-1] != '*' || p[2] != '*')) {
break; break;
} }
@@ -2427,9 +2427,9 @@ void showmatch(int c)
showruler(false); showruler(false);
setcursor(); setcursor();
ui_flush(); ui_flush();
/* Restore dollar_vcol(), because setcursor() may call curs_rows() // Restore dollar_vcol(), because setcursor() may call curs_rows()
* which resets it if the matching position is in a previous line // which resets it if the matching position is in a previous line
* and has a higher column number. */ // and has a higher column number.
dollar_vcol = save_dollar_vcol; dollar_vcol = save_dollar_vcol;
/* /*
@@ -2595,8 +2595,8 @@ bool findpar(bool *pincl, int dir, long count, int what, int both)
bool first; // true on first line bool first; // true on first line
linenr_T fold_first; // first line of a closed fold linenr_T fold_first; // first line of a closed fold
linenr_T fold_last; // last line of a closed fold linenr_T fold_last; // last line of a closed fold
bool fold_skipped; /* true if a closed fold was skipped this bool fold_skipped; // true if a closed fold was skipped this
iteration */ // iteration
curr = curwin->w_cursor.lnum; curr = curwin->w_cursor.lnum;
@@ -2658,10 +2658,10 @@ static int inmacro(char_u *opt, char_u *s)
{ {
char_u *macro; char_u *macro;
for (macro = opt; macro[0]; ++macro) { for (macro = opt; macro[0]; macro++) {
/* Accept two characters in the option being equal to two characters // Accept two characters in the option being equal to two characters
* in the line. A space in the option matches with a space in the // in the line. A space in the option matches with a space in the
* line or the line having ended. */ // line or the line having ended.
if ( (macro[0] == s[0] if ( (macro[0] == s[0]
|| (macro[0] == ' ' || (macro[0] == ' '
&& (s[0] == NUL || s[0] == ' '))) && (s[0] == NUL || s[0] == ' ')))
@@ -2756,8 +2756,8 @@ int fwd_word(long count, int bigword, int eol)
curwin->w_cursor.coladd = 0; curwin->w_cursor.coladd = 0;
cls_bigword = bigword; cls_bigword = bigword;
while (--count >= 0) { while (--count >= 0) {
/* When inside a range of folded lines, move to the last char of the // When inside a range of folded lines, move to the last char of the
* last line. */ // last line.
if (hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum)) { if (hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum)) {
coladvance(MAXCOL); coladvance(MAXCOL);
} }
@@ -3675,9 +3675,9 @@ again:
xfree(epat); xfree(epat);
if (r < 1 || lt(curwin->w_cursor, old_end)) { if (r < 1 || lt(curwin->w_cursor, old_end)) {
/* Can't find other end or it's before the previous end. Could be a // Can't find other end or it's before the previous end. Could be a
* HTML tag that doesn't have a matching end. Search backwards for // HTML tag that doesn't have a matching end. Search backwards for
* another starting tag. */ // another starting tag.
count = 1; count = 1;
curwin->w_cursor = start_pos; curwin->w_cursor = start_pos;
goto again; goto again;
@@ -3729,8 +3729,8 @@ again:
} }
if (VIsual_active) { if (VIsual_active) {
/* If the end is before the start there is no text between tags, select // If the end is before the start there is no text between tags, select
* the char under the cursor. */ // the char under the cursor.
if (lt(end_pos, start_pos)) { if (lt(end_pos, start_pos)) {
curwin->w_cursor = start_pos; curwin->w_cursor = start_pos;
} else if (*p_sel == 'e') { } else if (*p_sel == 'e') {
@@ -3744,8 +3744,8 @@ again:
oap->start = start_pos; oap->start = start_pos;
oap->motion_type = kMTCharWise; oap->motion_type = kMTCharWise;
if (lt(end_pos, start_pos)) { if (lt(end_pos, start_pos)) {
/* End is before the start: there is no text between tags; operate // End is before the start: there is no text between tags; operate
* on an empty area. */ // on an empty area.
curwin->w_cursor = start_pos; curwin->w_cursor = start_pos;
oap->inclusive = false; oap->inclusive = false;
} else { } else {
@@ -4112,10 +4112,10 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
first_col = find_prev_quote(line, col_start, quotechar, NULL); first_col = find_prev_quote(line, col_start, quotechar, NULL);
} }
} }
/* The cursor is on a quote, we don't know if it's the opening or // The cursor is on a quote, we don't know if it's the opening or
* closing quote. Search from the start of the line to find out. // closing quote. Search from the start of the line to find out.
* Also do this when there is a Visual area, a' may leave the cursor // Also do this when there is a Visual area, a' may leave the cursor
* in between two strings. */ // in between two strings.
col_start = 0; col_start = 0;
for (;; ) { for (;; ) {
// Find open quote character. // Find open quote character.
@@ -4169,18 +4169,17 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
} }
} }
/* Set start position. After vi" another i" must include the ". // Set start position. After vi" another i" must include the ".
* For v2i" include the quotes. */ // For v2i" include the quotes.
if (!include && count < 2 if (!include && count < 2
&& (vis_empty || !inside_quotes)) { && (vis_empty || !inside_quotes)) {
++col_start; ++col_start;
} }
curwin->w_cursor.col = col_start; curwin->w_cursor.col = col_start;
if (VIsual_active) { if (VIsual_active) {
/* Set the start of the Visual area when the Visual area was empty, we // Set the start of the Visual area when the Visual area was empty, we
* were just inside quotes or the Visual area didn't start at a quote // were just inside quotes or the Visual area didn't start at a quote
* and didn't include a quote. // and didn't include a quote.
*/
if (vis_empty if (vis_empty
|| (vis_bef_curs || (vis_bef_curs
&& !selected_quote && !selected_quote
@@ -4211,9 +4210,9 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
dec_cursor(); dec_cursor();
} }
} else { } else {
/* Cursor is at start of Visual area. Set the end of the Visual // Cursor is at start of Visual area. Set the end of the Visual
* area when it was just inside quotes or it didn't end at a // area when it was just inside quotes or it didn't end at a
* quote. */ // quote.
if (inside_quotes if (inside_quotes
|| (!selected_quote || (!selected_quote
&& line[VIsual.col] != quotechar && line[VIsual.col] != quotechar
@@ -4911,14 +4910,14 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
msg_home_replace(files[depth_displayed].name); msg_home_replace(files[depth_displayed].name);
MSG_PUTS(" -->\n"); MSG_PUTS(" -->\n");
} }
if (!got_int) { /* don't display if 'q' typed if (!got_int) { // don't display if 'q' typed
for "--more--" message */ // for "--more--" message
for (i = 0; i <= depth_displayed; i++) { for (i = 0; i <= depth_displayed; i++) {
MSG_PUTS(" "); MSG_PUTS(" ");
} }
if (new_fname != NULL) { if (new_fname != NULL) {
/* using "new_fname" is more reliable, e.g., when // using "new_fname" is more reliable, e.g., when
* 'includeexpr' is set. */ // 'includeexpr' is set.
msg_outtrans_attr(new_fname, HL_ATTR(HLF_D)); msg_outtrans_attr(new_fname, HL_ATTR(HLF_D));
} else { } else {
/* /*