aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDundar Göc <gocdundar@gmail.com>2021-10-20 21:14:31 +0200
committerDundar Göc <gocdundar@gmail.com>2021-10-21 12:07:14 +0200
commitdaf670dde68355d28cb6ce2be7007ec2f992dc61 (patch)
treedf89c58f2a567ce674b49ea628679e8c46a3b58e
parentce441b8b137f702e3f7873fd38fdd93380a26519 (diff)
downloadrneovim-daf670dde68355d28cb6ce2be7007ec2f992dc61.tar.gz
rneovim-daf670dde68355d28cb6ce2be7007ec2f992dc61.tar.bz2
rneovim-daf670dde68355d28cb6ce2be7007ec2f992dc61.zip
vim-patch:8.1.2394: using old C style comments
Problem: Using old C style comments. Solution: Use // comments where appropriate. https://github.com/vim/vim/commit/63d9e730f726341bf41ee4f4b829253cb9879110
-rw-r--r--src/nvim/regexp.c52
-rw-r--r--src/nvim/regexp_nfa.c191
-rw-r--r--src/nvim/screen.c22
-rw-r--r--src/nvim/search.c107
4 files changed, 188 insertions, 184 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 24dc86e034..d39d6c69f1 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -461,8 +461,8 @@ static int toggle_Magic(int x)
*/
#define UCHARAT(p) ((int)*(char_u *)(p))
-/* Used for an error (down from) vim_regcomp(): give the error message, set
- * rc_did_emsg and return NULL */
+// Used for an error (down from) vim_regcomp(): give the error message, set
+// rc_did_emsg and return 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 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_ALL 4 /* "\v" very magic */
-static int reg_string; /* matching with a string instead of a buffer
- line */
-static int reg_strict; /* "[abc" is illegal */
+static int reg_string; // matching with a string instead of a buffer
+ // line
+static int reg_strict; // "[abc" is illegal
/*
* 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
};
-static int curchr; /* currently parsed character */
-/* 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,
- * because ^ was taken to be magic -- webb */
+static int curchr; // currently parsed character
+// 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,
+// because ^ was taken to be magic -- webb
static int prevchr;
static int prevprevchr; /* previous-previous character */
static int nextchr; /* used for ungetchr() */
@@ -2835,21 +2835,22 @@ static int peekchr(void)
curchr = Magic(curchr);
break;
case '*':
- /* * is not magic as the very first character, eg "?*ptr", when
- * after '^', eg "/^*ptr" and when after "\(", "\|", "\&". But
- * "\(\*" is not magic, thus must be magic if "after_slash" */
+ // * is not magic as the very first character, eg "?*ptr", when
+ // after '^', eg "/^*ptr" and when after "\(", "\|", "\&". But
+ // "\(\*" is not magic, thus must be magic if "after_slash"
if (reg_magic >= MAGIC_ON
&& !at_start
&& !(prev_at_start && prevchr == Magic('^'))
&& (after_slash
|| (prevchr != Magic('(')
&& prevchr != Magic('&')
- && prevchr != Magic('|'))))
+ && prevchr != Magic('|')))) {
curchr = Magic('*');
+ }
break;
case '^':
- /* '^' is only magic as the very first character and if it's after
- * "\(", "\|", "\&' or "\n" */
+ // '^' is only magic as the very first character and if it's after
+ // "\(", "\|", "\&' or "\n"
if (reg_magic >= MAGIC_OFF
&& (at_start
|| reg_magic == MAGIC_ALL
@@ -2865,8 +2866,8 @@ static int peekchr(void)
}
break;
case '$':
- /* '$' is only magic as the very last char and if it's in front of
- * either "\|", "\)", "\&", or "\n" */
+ // '$' is only magic as the very last char and if it's in front of
+ // either "\|", "\)", "\&", or "\n"
if (reg_magic >= MAGIC_OFF) {
char_u *p = regparse + 1;
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)
*bytelen = 0;
for (;; ) {
- /* Since getting one line may invalidate the other, need to make copy.
- * Slow! */
+ // Since getting one line may invalidate the other, need to make copy.
+ // Slow!
if (rex.line != reg_tofree) {
len = (int)STRLEN(rex.line);
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;
}
-/***************************************************************
-* regsub stuff *
-***************************************************************/
+////////////////////////////////////////////////////////////////
+// regsub stuff //
+////////////////////////////////////////////////////////////////
/* 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);
/* interpret tilde */
memmove(tmpsub + len, reg_prev_sub, (size_t)prevlen);
- /* copy postfix */
- if (!magic)
- ++p; /* back off \ */
+ // copy postfix
+ if (!magic) {
+ p++; // back off backslash
+ }
STRCPY(tmpsub + len + prevlen, p + 1);
if (newsub != source) /* already allocated newsub */
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index c8b7190b4a..0eb061034f 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -48,14 +48,14 @@ enum {
NFA_MATCH,
NFA_EMPTY, /* matches 0-length */
- NFA_START_COLL, /* [abc] start */
- NFA_END_COLL, /* [abc] end */
- NFA_START_NEG_COLL, /* [^abc] start */
- NFA_END_NEG_COLL, /* [^abc] end (postfix only) */
- NFA_RANGE, /* range of the two previous items
- * (postfix only) */
- NFA_RANGE_MIN, /* low end of a range */
- NFA_RANGE_MAX, /* high end of a range */
+ NFA_START_COLL, // [abc] start
+ NFA_END_COLL, // [abc] end
+ NFA_START_NEG_COLL, // [^abc] start
+ NFA_END_NEG_COLL, // [^abc] end (postfix only)
+ NFA_RANGE, // range of the two previous items
+ // (postfix only)
+ NFA_RANGE_MIN, // low end of a range
+ NFA_RANGE_MAX, // high end of a range
NFA_CONCAT, // concatenate two previous items (postfix
// only)
@@ -88,9 +88,9 @@ enum {
NFA_END_INVISIBLE,
NFA_END_INVISIBLE_NEG,
NFA_END_PATTERN,
- NFA_COMPOSING, /* Next nodes in NFA are part of the
- composing multibyte char */
- NFA_END_COMPOSING, /* End of a composing char in the NFA */
+ NFA_COMPOSING, // Next nodes in NFA are part of the
+ // composing multibyte char
+ NFA_END_COMPOSING, // End of a composing char in the NFA
NFA_ANY_COMPOSING, // \%C: Any composing characters.
NFA_OPT_CHARS, /* \%[abc] */
@@ -256,9 +256,9 @@ static char_u e_ill_char_class[] = N_(
"E877: (NFA regexp) Invalid character class: %" PRId64);
static char_u e_value_too_large[] = N_("E951: \\% value too large");
-/* Since the out pointers in the list are always
- * uninitialized, we use the pointers themselves
- * as storage for the Ptrlists. */
+// Since the out pointers in the list are always
+// uninitialized, we use the pointers themselves
+// as storage for the Ptrlists.
typedef union Ptrlist Ptrlist;
union Ptrlist {
Ptrlist *next;
@@ -310,9 +310,9 @@ struct nfa_pim_S {
typedef struct {
nfa_state_T *state;
int count;
- nfa_pim_T pim; /* if pim.result != NFA_PIM_UNUSED: postponed
- * invisible match */
- regsubs_T subs; /* submatch info, only party used */
+ nfa_pim_T pim; // if pim.result != NFA_PIM_UNUSED: postponed
+ // invisible match
+ regsubs_T subs; // submatch info, only party used
} nfa_thread_T;
// nfa_list_T contains the alternative NFA execution states.
@@ -1675,13 +1675,13 @@ collection:
}
/* Try collating class like [. .] */
if (collclass != 0) {
- startc = collclass; /* allow [.a.]-x as a range */
- /* Will emit the proper atom at the end of the
- * while loop. */
+ startc = collclass; // allow [.a.]-x as a range
+ // Will emit the proper atom at the end of the
+ // while loop.
}
}
- /* Try a range like 'a-x' or '\t-z'. Also allows '-' as a
- * start character. */
+ // Try a range like 'a-x' or '\t-z'. Also allows '-' as a
+ // start character.
if (*regparse == '-' && oldstartc != -1) {
emit_range = true;
startc = oldstartc;
@@ -1689,11 +1689,10 @@ collection:
continue; // reading the end of the range
}
- /* Now handle simple and escaped characters.
- * Only "\]", "\^", "\]" and "\\" are special in Vi. Vim
- * accepts "\t", "\e", etc., but only when the 'l' flag in
- * 'cpoptions' is not included.
- */
+ // Now handle simple and escaped characters.
+ // Only "\]", "\^", "\]" and "\\" are special in Vi. Vim
+ // accepts "\t", "\e", etc., but only when the 'l' flag in
+ // 'cpoptions' is not included.
if (*regparse == '\\'
&& regparse + 1 <= endp
&& (vim_strchr(REGEXP_INRANGE, regparse[1]) != NULL
@@ -1736,13 +1735,14 @@ collection:
}
if (endc > startc + 2) {
- /* Emit a range instead of the sequence of
- * individual characters. */
- if (startc == 0)
- /* \x00 is translated to \x0a, start at \x01. */
+ // Emit a range instead of the sequence of
+ // individual characters.
+ if (startc == 0) {
+ // \x00 is translated to \x0a, start at \x01.
EMIT(1);
- else
- --post_ptr; /* remove NFA_CONCAT */
+ } else {
+ post_ptr--; // remove NFA_CONCAT
+ }
EMIT(endc);
EMIT(NFA_RANGE);
EMIT(NFA_CONCAT);
@@ -1755,8 +1755,8 @@ collection:
EMIT(NFA_CONCAT);
}
} else {
- /* Emit the range. "startc" was already emitted, so
- * skip it. */
+ // Emit the range. "startc" was already emitted, so
+ // skip it.
for (c = startc + 1; c <= endc; c++) {
EMIT(c);
EMIT(NFA_CONCAT);
@@ -1765,19 +1765,20 @@ collection:
emit_range = false;
startc = -1;
} else {
- /* This char (startc) is not part of a range. Just
- * emit it.
- * Normally, simply emit startc. But if we get char
- * code=0 from a collating char, then replace it with
- * 0x0a.
- * This is needed to completely mimic the behaviour of
- * the backtracking engine. */
+ // This char (startc) is not part of a range. Just
+ // emit it.
+ // Normally, simply emit startc. But if we get char
+ // code=0 from a collating char, then replace it with
+ // 0x0a.
+ // This is needed to completely mimic the behaviour of
+ // the backtracking engine.
if (startc == NFA_NEWL) {
- /* Line break can't be matched as part of the
- * collection, add an OR below. But not for negated
- * range. */
- if (!negated)
+ // Line break can't be matched as part of the
+ // collection, add an OR below. But not for negated
+ // range.
+ if (!negated) {
extra = NFA_ADD_NL;
+ }
} else {
if (got_coll_char == true && startc == 0) {
EMIT(0x0a);
@@ -1831,14 +1832,14 @@ nfa_do_multibyte:
|| utf_iscomposing(c)) {
int i = 0;
- /* A base character plus composing characters, or just one
- * or more composing characters.
- * This requires creating a separate atom as if enclosing
- * the characters in (), where NFA_COMPOSING is the ( and
- * NFA_END_COMPOSING is the ). Note that right now we are
- * building the postfix form, not the NFA itself;
- * a composing char could be: a, b, c, NFA_COMPOSING
- * where 'b' and 'c' are chars with codes > 256. */
+ // A base character plus composing characters, or just one
+ // or more composing characters.
+ // This requires creating a separate atom as if enclosing
+ // the characters in (), where NFA_COMPOSING is the ( and
+ // NFA_END_COMPOSING is the ). Note that right now we are
+ // building the postfix form, not the NFA itself;
+ // a composing char could be: a, b, c, NFA_COMPOSING
+ // where 'b' and 'c' are chars with codes > 256. */
for (;; ) {
EMIT(c);
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_NEG_COLL:
- /* On the stack is the sequence starting with NFA_START_COLL or
- * NFA_START_NEG_COLL and all possible characters. Patch it to
- * add the output to the start. */
+ // On the stack is the sequence starting with NFA_START_COLL or
+ // NFA_START_NEG_COLL and all possible characters. Patch it to
+ // add the output to the start.
if (nfa_calc_size == true) {
nstate++;
break;
@@ -3233,12 +3234,12 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
if (before)
n = *++p; /* get the count */
- /* The \@= operator: match the preceding atom with zero width.
- * The \@! operator: no match for the preceding atom.
- * The \@<= operator: match for the preceding atom.
- * The \@<! operator: no match for the preceding atom.
- * Surrounds the preceding atom with START_INVISIBLE and
- * END_INVISIBLE, similarly to MOPEN. */
+ // The \@= operator: match the preceding atom with zero width.
+ // The \@! operator: no match for the preceding atom.
+ // The \@<= operator: match for the preceding atom.
+ // The \@<! operator: no match for the preceding atom.
+ // Surrounds the preceding atom with START_INVISIBLE and
+ // END_INVISIBLE, similarly to MOPEN.
if (nfa_calc_size == true) {
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);
PUSH(frag(s, list1(&s1->out)));
if (before) {
- if (n <= 0)
- /* See if we can guess the maximum width, it avoids a
- * lot of pointless tries. */
+ if (n <= 0) {
+ // See if we can guess the maximum width, it avoids a
+ // lot of pointless tries.
n = nfa_max_width(e.start, 0);
- s->val = n; /* store the count */
+ }
+ s->val = n; // store the count
}
}
break;
@@ -3516,8 +3518,8 @@ static void nfa_postprocess(nfa_regprog_T *prog)
directly = ch_follows * 10 < ch_invisible;
}
} else {
- /* normal invisible, first do the one with the
- * highest failure chance */
+ // normal invisible, first do the one with the
+ // highest failure chance
directly = ch_follows < ch_invisible;
}
}
@@ -4012,8 +4014,8 @@ static regsubs_T *addstate(
case NFA_ZEND:
case NFA_SPLIT:
case NFA_EMPTY:
- /* These nodes are not added themselves but their "out" and/or
- * "out1" may be added below. */
+ // These nodes are not added themselves but their "out" and/or
+ // "out1" may be added below.
break;
case NFA_BOL:
@@ -4051,21 +4053,20 @@ static regsubs_T *addstate(
case NFA_ZOPEN9:
case NFA_NOPEN:
case NFA_ZSTART:
- /* 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
- * endless loop for "\(\)*" */
+ // 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
+ // endless loop for "\(\)*"
default:
if (state->lastlist[nfa_ll_index] == l->id && state->c != NFA_SKIP) {
- /* This state is already in the list, don't add it again,
- * unless it is an MOPEN that is used for a backreference or
- * when there is a PIM. For NFA_MATCH check the position,
- * lower position is preferred. */
+ // This state is already in the list, don't add it again,
+ // unless it is an MOPEN that is used for a backreference or
+ // when there is a PIM. For NFA_MATCH check the position,
+ // lower position is preferred.
if (!rex.nfa_has_backref && pim == NULL && !l->has_pim
&& state->c != NFA_MATCH) {
-
- /* When called from addstate_here() do insert before
- * existing states. */
+ // When called from addstate_here() do insert before
+ // existing states.
if (add_here) {
for (k = 0; k < l->n && k < listindex; ++k) {
if (l->t[k].state->id == state->id) {
@@ -4088,10 +4089,11 @@ skip_add:
}
}
- /* Do not add the state again when it exists with the same
- * positions. */
- if (has_state_with_pos(l, state, subs, pim))
+ // Do not add the state again when it exists with the same
+ // positions.
+ if (has_state_with_pos(l, state, subs, pim)) {
goto skip_add;
+ }
}
// When there are backreferences or PIMs the number of states may
@@ -4362,9 +4364,9 @@ static regsubs_T *addstate_here(
int count;
int listidx = *ip;
- /* 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
- * addstate(). */
+ // 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
+ // addstate().
regsubs_T *r = addstate(l, state, subs, pim, -listidx - ADDSTATE_HERE_OFFSET);
if (r == NULL) {
return NULL;
@@ -4385,8 +4387,8 @@ static regsubs_T *addstate_here(
l->t[listidx] = l->t[l->n - 1];
} else if (count > 1) {
if (l->n + count - 1 >= l->len) {
- /* not enough space to move the new states, reallocate the list
- * and move the states to the right position */
+ // not enough space to move the new states, reallocate the list
+ // and move the states to the right position
const int newlen = l->len * 3 / 2 + 50;
const size_t newsize = newlen * sizeof(nfa_thread_T);
@@ -4408,8 +4410,8 @@ static regsubs_T *addstate_here(
xfree(l->t);
l->t = newl;
} else {
- /* make space for new states, then move them from the
- * end to the current position */
+ // make space for new states, then move them from the
+ // end to the current position
memmove(&(l->t[listidx + count]),
&(l->t[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) {
- /* Skip ahead until a character we know the match must start with.
- * When there is none there is no match. */
- if (skip_to_start(prog->regstart, &col) == FAIL)
+ // Skip ahead until a character we know the match must start with.
+ // When there is none there is no match.
+ if (skip_to_start(prog->regstart, &col) == FAIL) {
return 0L;
+ }
// If match_text is set it contains the full text that must match.
// Nothing else to try. Doesn't handle combining chars well.
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 32eb28e761..04542b0e47 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -694,7 +694,7 @@ void conceal_check_cursor_line(void)
if (curwin->w_p_cole > 0 && (conceal_cursor_used != should_conceal)) {
redrawWinline(curwin, curwin->w_cursor.lnum);
// Need to recompute cursor column, e.g., when starting Visual mode
- // without concealing. */
+ // without concealing.
curs_columns(curwin, true);
}
}
@@ -4827,8 +4827,8 @@ static void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol,
}
if (clear_next) {
- /* Clear the second half of a double-wide character of which the left
- * half was overwritten with a single-wide character. */
+ // Clear the second half of a double-wide character of which the left
+ // half was overwritten with a single-wide character.
schar_from_ascii(grid->chars[off_to], ' ');
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;
} else {
- /* Create status line if needed by setting 'laststatus' to 2.
- * Set 'winminheight' to zero to avoid that the window is
- * resized. */
+ // Create status line if needed by setting 'laststatus' to 2.
+ // Set 'winminheight' to zero to avoid that the window is
+ // resized.
if (lastwin->w_status_height == 0) {
save_p_ls = p_ls;
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
- * set. */
+ // Reset the flag here again, in case evaluating 'tabline' causes it to be
+ // set.
redraw_tabline = false;
}
@@ -7390,9 +7390,9 @@ int fillchar_status(int *attr, win_T *wp)
*attr = win_hl_attr(wp, HLF_SNC);
fill = wp->w_p_fcs_chars.stlnc;
}
- /* Use fill when there is highlighting, and highlighting of current
- * window differs, or the fillchars differ, or this is not the
- * current window */
+ // Use fill when there is highlighting, and highlighting of current
+ // window differs, or the fillchars differ, or this is not the
+ // current window
if (*attr != 0 && ((win_hl_attr(wp, HLF_S) != win_hl_attr(wp, HLF_SNC)
|| !is_curwin || ONE_WINDOW)
|| (wp->w_p_fcs_chars.stl != wp->w_p_fcs_chars.stlnc))) {
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 1b54d12042..c3a5f8dbe6 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -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 (nmatched > 1) {
- /* end is in next line, thus no match in
- * this line */
+ // end is in next line, thus no match in
+ // this line
match_ok = false;
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;
for (;; ) {
- /* Remember a position that is before the start
- * position, we use it if it's the last match in
- * the line. Always accept a position after
- * wrapping around. */
+ // Remember a position that is before the start
+ // position, we use it if it's the last match in
+ // the line. Always accept a position after
+ // wrapping around.
if (loop
|| ((options & SEARCH_END)
? (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;
}
- /* Cancel searching if a character was typed. Used for
- * 'incsearch'. Don't check too often, that would slowdown
- * searching too much. */
+ // Cancel searching if a character was typed. Used for
+ // 'incsearch'. Don't check too often, that would slowdown
+ // searching too much.
if ((options & SEARCH_PEEK)
&& ((lnum - pos->lnum) & 0x3f) == 0
&& 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
- * fold. */
+ // If the cursor is in a closed fold, don't find another match in the same
+ // fold.
if (dirc == '/') {
if (hasFolding(pos.lnum, NULL, &pos.lnum)) {
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) {
int col, bslcnt = 0;
- /* Set "match_escaped" if there are an odd number of
- * backslashes. */
+ // Set "match_escaped" if there are an odd number of
+ // backslashes.
for (col = pos.col; check_prevcol(linep, col, '\\', &col); ) {
bslcnt++;
}
@@ -2033,8 +2033,8 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|| (lisp && comment_col != MAXCOL
&& pos.col == (colnr_T)comment_col)) {
if (pos.lnum == curbuf->b_ml.ml_line_count // end of file
- /* line is exhausted and comment with it,
- * don't search for match in code */
+ // line is exhausted and comment with it,
+ // don't search for match in code
|| lispcomm) {
break;
}
@@ -2271,8 +2271,8 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
break;
}
- /* Check for match outside of quotes, and inside of
- * quotes when the start is also inside of quotes. */
+ // Check for match outside of quotes, and inside of
+ // quotes when the start is also inside of quotes.
if ((!inquote || start_in_quotes == kTrue)
&& (c == initc || c == findc)) {
int col, bslcnt = 0;
@@ -2340,8 +2340,8 @@ static int check_linecomment(const char_u *line)
}
} else {
while ((p = vim_strchr(p, '/')) != NULL) {
- /* accept a double /, unless it's preceded with * and followed by *,
- * because * / / * is an end and start of a C comment */
+ // accept a double /, unless it's preceded with * and followed by *,
+ // because * / / * is an end and start of a C comment
if (p[1] == '/' && (p == line || p[-1] != '*' || p[2] != '*')) {
break;
}
@@ -2427,9 +2427,9 @@ void showmatch(int c)
showruler(false);
setcursor();
ui_flush();
- /* Restore dollar_vcol(), because setcursor() may call curs_rows()
- * which resets it if the matching position is in a previous line
- * and has a higher column number. */
+ // Restore dollar_vcol(), because setcursor() may call curs_rows()
+ // which resets it if the matching position is in a previous line
+ // and has a higher column number.
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
linenr_T fold_first; // first 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
- iteration */
+ bool fold_skipped; // true if a closed fold was skipped this
+ // iteration
curr = curwin->w_cursor.lnum;
@@ -2658,10 +2658,10 @@ static int inmacro(char_u *opt, char_u *s)
{
char_u *macro;
- for (macro = opt; macro[0]; ++macro) {
- /* 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
- * line or the line having ended. */
+ for (macro = opt; macro[0]; macro++) {
+ // 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
+ // line or the line having ended.
if ( (macro[0] == s[0]
|| (macro[0] == ' '
&& (s[0] == NUL || s[0] == ' ')))
@@ -2756,8 +2756,8 @@ int fwd_word(long count, int bigword, int eol)
curwin->w_cursor.coladd = 0;
cls_bigword = bigword;
while (--count >= 0) {
- /* When inside a range of folded lines, move to the last char of the
- * last line. */
+ // When inside a range of folded lines, move to the last char of the
+ // last line.
if (hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum)) {
coladvance(MAXCOL);
}
@@ -3675,9 +3675,9 @@ again:
xfree(epat);
if (r < 1 || lt(curwin->w_cursor, old_end)) {
- /* 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
- * another starting tag. */
+ // 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
+ // another starting tag.
count = 1;
curwin->w_cursor = start_pos;
goto again;
@@ -3729,8 +3729,8 @@ again:
}
if (VIsual_active) {
- /* If the end is before the start there is no text between tags, select
- * the char under the cursor. */
+ // If the end is before the start there is no text between tags, select
+ // the char under the cursor.
if (lt(end_pos, start_pos)) {
curwin->w_cursor = start_pos;
} else if (*p_sel == 'e') {
@@ -3744,8 +3744,8 @@ again:
oap->start = start_pos;
oap->motion_type = kMTCharWise;
if (lt(end_pos, start_pos)) {
- /* End is before the start: there is no text between tags; operate
- * on an empty area. */
+ // End is before the start: there is no text between tags; operate
+ // on an empty area.
curwin->w_cursor = start_pos;
oap->inclusive = false;
} 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);
}
}
- /* 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.
- * Also do this when there is a Visual area, a' may leave the cursor
- * in between two strings. */
+ // 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.
+ // Also do this when there is a Visual area, a' may leave the cursor
+ // in between two strings.
col_start = 0;
for (;; ) {
// 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 ".
- * For v2i" include the quotes. */
+ // Set start position. After vi" another i" must include the ".
+ // For v2i" include the quotes.
if (!include && count < 2
&& (vis_empty || !inside_quotes)) {
++col_start;
}
curwin->w_cursor.col = col_start;
if (VIsual_active) {
- /* 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
- * and didn't include a quote.
- */
+ // 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
+ // and didn't include a quote.
if (vis_empty
|| (vis_bef_curs
&& !selected_quote
@@ -4211,9 +4210,9 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
dec_cursor();
}
} else {
- /* 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
- * quote. */
+ // 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
+ // quote.
if (inside_quotes
|| (!selected_quote
&& 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_PUTS(" -->\n");
}
- if (!got_int) { /* don't display if 'q' typed
- for "--more--" message */
+ if (!got_int) { // don't display if 'q' typed
+ // for "--more--" message
for (i = 0; i <= depth_displayed; i++) {
MSG_PUTS(" ");
}
if (new_fname != NULL) {
- /* using "new_fname" is more reliable, e.g., when
- * 'includeexpr' is set. */
+ // using "new_fname" is more reliable, e.g., when
+ // 'includeexpr' is set.
msg_outtrans_attr(new_fname, HL_ATTR(HLF_D));
} else {
/*