patch 8.1.2394: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
diff --git a/src/search.c b/src/search.c
index 3f34588..1a5dc1a 100644
--- a/src/search.c
+++ b/src/search.c
@@ -55,28 +55,28 @@
*/
static spat_T spats[2] =
{
- {NULL, TRUE, FALSE, {'/', 0, 0, 0L}}, /* last used search pat */
- {NULL, TRUE, FALSE, {'/', 0, 0, 0L}} /* last used substitute pat */
+ {NULL, TRUE, FALSE, {'/', 0, 0, 0L}}, // last used search pat
+ {NULL, TRUE, FALSE, {'/', 0, 0, 0L}} // last used substitute pat
};
-static int last_idx = 0; /* index in spats[] for RE_LAST */
+static int last_idx = 0; // index in spats[] for RE_LAST
-static char_u lastc[2] = {NUL, NUL}; /* last character searched for */
-static int lastcdir = FORWARD; /* last direction of character search */
-static int last_t_cmd = TRUE; /* last search t_cmd */
+static char_u lastc[2] = {NUL, NUL}; // last character searched for
+static int lastcdir = FORWARD; // last direction of character search
+static int last_t_cmd = TRUE; // last search t_cmd
static char_u lastc_bytes[MB_MAXBYTES + 1];
-static int lastc_bytelen = 1; /* >1 for multi-byte char */
+static int lastc_bytelen = 1; // >1 for multi-byte char
-/* copy of spats[], for keeping the search patterns while executing autocmds */
+// copy of spats[], for keeping the search patterns while executing autocmds
static spat_T saved_spats[2];
# ifdef FEAT_SEARCH_EXTRA
static int saved_spats_last_idx = 0;
static int saved_spats_no_hlsearch = 0;
# endif
-static char_u *mr_pattern = NULL; /* pattern used by search_regcomp() */
+static char_u *mr_pattern = NULL; // pattern used by search_regcomp()
#ifdef FEAT_RIGHTLEFT
-static int mr_pattern_alloced = FALSE; /* mr_pattern was allocated */
+static int mr_pattern_alloced = FALSE; // mr_pattern was allocated
#endif
#ifdef FEAT_FIND_ID
@@ -86,10 +86,10 @@
*/
typedef struct SearchedFile
{
- FILE *fp; /* File pointer */
- char_u *name; /* Full name of file */
- linenr_T lnum; /* Line we were up to in file */
- int matched; /* Found a match in this file */
+ FILE *fp; // File pointer
+ char_u *name; // Full name of file
+ linenr_T lnum; // Line we were up to in file
+ int matched; // Found a match in this file
} SearchedFile;
#endif
@@ -113,7 +113,7 @@
int pat_save,
int pat_use,
int options,
- regmmatch_T *regmatch) /* return: pattern and ignore-case flag */
+ regmmatch_T *regmatch) // return: pattern and ignore-case flag
{
int magic;
int i;
@@ -130,7 +130,7 @@
i = last_idx;
else
i = pat_use;
- if (spats[i].pat == NULL) /* pattern was never defined */
+ if (spats[i].pat == NULL) // pattern was never defined
{
if (pat_use == RE_SUBST)
emsg(_(e_nopresub));
@@ -143,7 +143,7 @@
magic = spats[i].magic;
no_smartcase = spats[i].no_scs;
}
- else if (options & SEARCH_HIS) /* put new pattern in history */
+ else if (options & SEARCH_HIS) // put new pattern in history
add_to_history(HIST_SEARCH, pat, TRUE, NUL);
#ifdef FEAT_RIGHTLEFT
@@ -159,7 +159,7 @@
rev_pattern = reverse_text(pat);
if (rev_pattern == NULL)
- mr_pattern = pat; /* out of memory, keep normal pattern. */
+ mr_pattern = pat; // out of memory, keep normal pattern.
else
{
mr_pattern = rev_pattern;
@@ -176,10 +176,10 @@
*/
if (!(options & SEARCH_KEEP) && !cmdmod.keeppatterns)
{
- /* search or global command */
+ // search or global command
if (pat_save == RE_SEARCH || pat_save == RE_BOTH)
save_re_pat(RE_SEARCH, pat, magic);
- /* substitute or global command */
+ // substitute or global command
if (pat_save == RE_SUBST || pat_save == RE_BOTH)
save_re_pat(RE_SUBST, pat, magic);
}
@@ -253,7 +253,7 @@
spats[idx].no_scs = no_smartcase;
last_idx = idx;
#ifdef FEAT_SEARCH_EXTRA
- /* If 'hlsearch' set and search pat changed: need redraw. */
+ // If 'hlsearch' set and search pat changed: need redraw.
if (p_hls)
redraw_all_later(SOME_VALID);
set_no_hlsearch(FALSE);
@@ -426,11 +426,11 @@
}
else if (*p == '\\')
{
- if (p[1] == '_' && p[2] != NUL) /* skip "\_X" */
+ if (p[1] == '_' && p[2] != NUL) // skip "\_X"
p += 3;
- else if (p[1] == '%' && p[2] != NUL) /* skip "\%X" */
+ else if (p[1] == '%' && p[2] != NUL) // skip "\%X"
p += 3;
- else if (p[1] != NUL) /* skip "\X" */
+ else if (p[1] != NUL) // skip "\X"
p += 2;
else
p += 1;
@@ -517,7 +517,7 @@
int setlast)
{
vim_free(spats[idx].pat);
- /* An empty string means that nothing should be matched. */
+ // An empty string means that nothing should be matched.
if (*s == NUL)
spats[idx].pat = NULL;
else
@@ -546,7 +546,7 @@
# endif
}
# ifdef FEAT_SEARCH_EXTRA
- /* If 'hlsearch' set and search pat changed: need redraw. */
+ // If 'hlsearch' set and search pat changed: need redraw.
if (p_hls && idx == last_idx && !no_hlsearch)
redraw_all_later(SOME_VALID);
# endif
@@ -567,7 +567,7 @@
regmatch->regprog = NULL;
return;
}
- ++emsg_off; /* So it doesn't beep if bad expr */
+ ++emsg_off; // So it doesn't beep if bad expr
(void)search_regcomp((char_u *)"", 0, last_idx, SEARCH_KEEP, regmatch);
--emsg_off;
}
@@ -608,7 +608,7 @@
searchit_arg_T *extra_arg) // optional extra arguments, can be NULL
{
int found;
- linenr_T lnum; /* no init to shut up Apollo cc */
+ linenr_T lnum; // no init to shut up Apollo cc
colnr_T col;
regmmatch_T regmatch;
char_u *ptr;
@@ -655,14 +655,14 @@
* find the string
*/
called_emsg = FALSE;
- do /* loop for count */
+ do // loop for count
{
- /* When not accepting a match at the start position set "extra_col" to
- * a non-zero value. Don't do that when starting at MAXCOL, since
- * MAXCOL + 1 is zero. */
+ // When not accepting a match at the start position set "extra_col" to
+ // a non-zero value. Don't do that when starting at MAXCOL, since
+ // MAXCOL + 1 is zero.
if (pos->col == MAXCOL)
start_char_len = 0;
- /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */
+ // Watch out for the "col" being MAXCOL - 2, used in a closed fold.
else if (has_mbyte
&& pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
&& pos->col < MAXCOL - 2)
@@ -690,14 +690,14 @@
extra_col = 0;
}
- start_pos = *pos; /* remember start pos for detecting no match */
- found = 0; /* default: not found */
- at_first_line = TRUE; /* default: start in first line */
- if (pos->lnum == 0) /* correct lnum for when starting in line 0 */
+ start_pos = *pos; // remember start pos for detecting no match
+ found = 0; // default: not found
+ at_first_line = TRUE; // default: start in first line
+ if (pos->lnum == 0) // correct lnum for when starting in line 0
{
pos->lnum = 1;
pos->col = 0;
- at_first_line = FALSE; /* not in first line now */
+ at_first_line = FALSE; // not in first line now
}
/*
@@ -716,17 +716,17 @@
else
lnum = pos->lnum;
- for (loop = 0; loop <= 1; ++loop) /* loop twice if 'wrapscan' set */
+ for (loop = 0; loop <= 1; ++loop) // loop twice if 'wrapscan' set
{
for ( ; lnum > 0 && lnum <= buf->b_ml.ml_line_count;
lnum += dir, at_first_line = FALSE)
{
- /* Stop after checking "stop_lnum", if it's set. */
+ // Stop after checking "stop_lnum", if it's set.
if (stop_lnum != 0 && (dir == FORWARD
? lnum > stop_lnum : lnum < stop_lnum))
break;
#ifdef FEAT_RELTIME
- /* Stop after passing the "tm" time limit. */
+ // Stop after passing the "tm" time limit.
if (tm != NULL && profile_passed_limit(tm))
break;
#endif
@@ -744,7 +744,7 @@
NULL, NULL
#endif
);
- /* Abort searching on an error (e.g., out of stack). */
+ // Abort searching on an error (e.g., out of stack).
if (called_emsg
#ifdef FEAT_RELTIME
|| (timed_out != NULL && *timed_out)
@@ -753,13 +753,13 @@
break;
if (nmatched > 0)
{
- /* match may actually be in another line when using \zs */
+ // match may actually be in another line when using \zs
matchpos = regmatch.startpos[0];
endpos = regmatch.endpos[0];
#ifdef FEAT_EVAL
submatch = first_submatch(®match);
#endif
- /* "lnum" may be past end of buffer for "\n\zs". */
+ // "lnum" may be past end of buffer for "\n\zs".
if (lnum + matchpos.lnum > buf->b_ml.ml_line_count)
ptr = (char_u *)"";
else
@@ -798,13 +798,13 @@
{
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;
}
matchcol = endpos.col;
- /* for empty match: advance one char */
+ // for empty match: advance one char
if (matchcol == matchpos.col
&& ptr[matchcol] != NUL)
{
@@ -849,8 +849,8 @@
submatch = first_submatch(®match);
# endif
- /* Need to get the line pointer again, a
- * multi-line search may have made it invalid. */
+ // Need to get the line pointer again, a
+ // multi-line search may have made it invalid.
ptr = ml_get_buf(buf, lnum + matchpos.lnum, FALSE);
}
if (!match_ok)
@@ -868,10 +868,10 @@
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
@@ -911,7 +911,7 @@
if (nmatched > 1)
break;
matchcol = endpos.col;
- /* for empty match: advance one char */
+ // for empty match: advance one char
if (matchcol == matchpos.col
&& ptr[matchcol] != NUL)
{
@@ -924,7 +924,7 @@
}
else
{
- /* Stop when the match is in a next line. */
+ // Stop when the match is in a next line.
if (matchpos.lnum > 0)
break;
matchcol = matchpos.col;
@@ -949,17 +949,17 @@
)) == 0)
{
#ifdef FEAT_RELTIME
- /* If the search timed out, we did find a match
- * but it might be the wrong one, so that's not
- * OK. */
+ // If the search timed out, we did find a match
+ // but it might be the wrong one, so that's not
+ // OK.
if (timed_out != NULL && *timed_out)
match_ok = FALSE;
#endif
break;
}
- /* Need to get the line pointer again, a
- * multi-line search may have made it invalid. */
+ // Need to get the line pointer again, a
+ // multi-line search may have made it invalid.
ptr = ml_get_buf(buf, lnum + matchpos.lnum, FALSE);
}
@@ -971,20 +971,20 @@
continue;
}
- /* With the SEARCH_END option move to the last character
- * of the match. Don't do it for an empty match, end
- * should be same as start then. */
+ // With the SEARCH_END option move to the last character
+ // of the match. Don't do it for an empty match, end
+ // should be same as start then.
if ((options & SEARCH_END) && !(options & SEARCH_NOOF)
&& !(matchpos.lnum == endpos.lnum
&& matchpos.col == endpos.col))
{
- /* For a match in the first column, set the position
- * on the NUL in the previous line. */
+ // For a match in the first column, set the position
+ // on the NUL in the previous line.
pos->lnum = lnum + endpos.lnum;
pos->col = endpos.col;
if (endpos.col == 0)
{
- if (pos->lnum > 1) /* just in case */
+ if (pos->lnum > 1) // just in case
{
--pos->lnum;
pos->col = (colnr_T)STRLEN(ml_get_buf(buf,
@@ -1023,19 +1023,19 @@
found = 1;
first_match = FALSE;
- /* Set variables used for 'incsearch' highlighting. */
+ // Set variables used for 'incsearch' highlighting.
search_match_lines = endpos.lnum - matchpos.lnum;
search_match_endcol = endpos.col;
break;
}
- line_breakcheck(); /* stop if ctrl-C typed */
+ line_breakcheck(); // stop if ctrl-C typed
if (got_int)
break;
#ifdef FEAT_SEARCH_EXTRA
- /* 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())
@@ -1046,7 +1046,7 @@
#endif
if (loop && lnum == start_pos.lnum)
- break; /* if second loop, stop where started */
+ break; // if second loop, stop where started
}
at_first_line = FALSE;
@@ -1072,7 +1072,7 @@
* is redrawn. The keep_msg is cleared whenever another message is
* written.
*/
- if (dir == BACKWARD) /* start second loop at the other end */
+ if (dir == BACKWARD) // start second loop at the other end
lnum = buf->b_ml.ml_line_count;
else
lnum = 1;
@@ -1092,13 +1092,13 @@
)
break;
}
- while (--count > 0 && found); /* stop after count matches or no match */
+ while (--count > 0 && found); // stop after count matches or no match
vim_regfree(regmatch.regprog);
called_emsg |= save_called_emsg;
- if (!found) /* did not find it */
+ if (!found) // did not find it
{
if (got_int)
emsg(_(e_interr));
@@ -1116,7 +1116,7 @@
return FAIL;
}
- /* A pattern like "\n\zs" may go past the last line. */
+ // A pattern like "\n\zs" may go past the last line.
if (pos->lnum > buf->b_ml.ml_line_count)
{
pos->lnum = buf->b_ml.ml_line_count;
@@ -1187,17 +1187,17 @@
*/
int
do_search(
- oparg_T *oap, /* can be NULL */
- int dirc, /* '/' or '?' */
+ oparg_T *oap, // can be NULL
+ int dirc, // '/' or '?'
char_u *pat,
long count,
int options,
searchit_arg_T *sia) // optional arguments or NULL
{
- pos_T pos; /* position of the last match */
+ pos_T pos; // position of the last match
char_u *searchstr;
soffset_T old_off;
- int retval; /* Return value */
+ int retval; // Return value
char_u *p;
long c;
char_u *dircp;
@@ -1223,7 +1223,7 @@
*/
old_off = spats[0].off;
- pos = curwin->w_cursor; /* start searching at the cursor position */
+ pos = curwin->w_cursor; // start searching at the cursor position
/*
* Find out the direction of the search.
@@ -1240,8 +1240,8 @@
if (options & SEARCH_REV)
{
#ifdef MSWIN
- /* There is a bug in the Visual C++ 2.2 compiler which means that
- * dirc always ends up being '/' */
+ // There is a bug in the Visual C++ 2.2 compiler which means that
+ // dirc always ends up being '/'
dirc = (dirc == '/') ? '?' : '/';
#else
if (dirc == '/')
@@ -1252,12 +1252,12 @@
}
#ifdef FEAT_FOLDING
- /* 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 */
+ pos.col = MAXCOL - 2; // avoid overflow when adding 1
}
else
{
@@ -1286,10 +1286,10 @@
searchstr = pat;
dircp = NULL;
- /* use previous pattern */
+ // use previous pattern
if (pat == NULL || *pat == NUL || *pat == dirc)
{
- if (spats[RE_SEARCH].pat == NULL) /* no previous pattern */
+ if (spats[RE_SEARCH].pat == NULL) // no previous pattern
{
searchstr = spats[RE_SUBST].pat;
if (searchstr == NULL)
@@ -1301,12 +1301,12 @@
}
else
{
- /* make search_regcomp() use spats[RE_SEARCH].pat */
+ // make search_regcomp() use spats[RE_SEARCH].pat
searchstr = (char_u *)"";
}
}
- if (pat != NULL && *pat != NUL) /* look for (new) offset */
+ if (pat != NULL && *pat != NUL) // look for (new) offset
{
/*
* Find end of regular expression.
@@ -1316,14 +1316,14 @@
p = skip_regexp(pat, dirc, (int)p_magic, &strcopy);
if (strcopy != ps)
{
- /* made a copy of "pat" to change "\?" to "?" */
+ // made a copy of "pat" to change "\?" to "?"
searchcmdlen += (int)(STRLEN(pat) - STRLEN(strcopy));
pat = strcopy;
searchstr = strcopy;
}
if (*p == dirc)
{
- dircp = p; /* remember where we put the NUL */
+ dircp = p; // remember where we put the NUL
*p++ = NUL;
}
spats[0].off.line = FALSE;
@@ -1340,28 +1340,28 @@
else if ((options & SEARCH_OPT) &&
(*p == 'e' || *p == 's' || *p == 'b'))
{
- if (*p == 'e') /* end */
+ if (*p == 'e') // end
spats[0].off.end = SEARCH_END;
++p;
}
- if (VIM_ISDIGIT(*p) || *p == '+' || *p == '-') /* got an offset */
+ if (VIM_ISDIGIT(*p) || *p == '+' || *p == '-') // got an offset
{
- /* 'nr' or '+nr' or '-nr' */
+ // 'nr' or '+nr' or '-nr'
if (VIM_ISDIGIT(*p) || VIM_ISDIGIT(*(p + 1)))
spats[0].off.off = atol((char *)p);
- else if (*p == '-') /* single '-' */
+ else if (*p == '-') // single '-'
spats[0].off.off = -1;
- else /* single '+' */
+ else // single '+'
spats[0].off.off = 1;
++p;
- while (VIM_ISDIGIT(*p)) /* skip number */
+ while (VIM_ISDIGIT(*p)) // skip number
++p;
}
- /* compute length of search command for get_address() */
+ // compute length of search command for get_address()
searchcmdlen += (int)(p - pat);
- pat = p; /* put pat after search command */
+ pat = p; // put pat after search command
}
if ((options & SEARCH_ECHO) && messaging() &&
@@ -1499,9 +1499,9 @@
for (c = spats[0].off.off; c; --c)
if (decl(&pos) == -1)
break;
- if (c) /* at start of buffer */
+ if (c) // at start of buffer
{
- pos.lnum = 0; /* allow lnum == 0 here */
+ pos.lnum = 0; // allow lnum == 0 here
pos.col = MAXCOL;
}
}
@@ -1510,7 +1510,7 @@
for (c = spats[0].off.off; c; ++c)
if (incl(&pos) == -1)
break;
- if (c) /* at end of buffer */
+ if (c) // at end of buffer
{
pos.lnum = curbuf->b_ml.ml_line_count + 1;
pos.col = 0;
@@ -1540,9 +1540,9 @@
goto end_do_search;
}
if (spats[0].off.end && oap != NULL)
- oap->inclusive = TRUE; /* 'e' includes last character */
+ oap->inclusive = TRUE; // 'e' includes last character
- retval = 1; /* pattern found */
+ retval = 1; // pattern found
/*
* Add character and/or line offset
@@ -1551,7 +1551,7 @@
{
pos_T org_pos = pos;
- if (spats[0].off.line) /* Add the offset to the line number. */
+ if (spats[0].off.line) // Add the offset to the line number.
{
c = pos.lnum + spats[0].off.off;
if (c < 1)
@@ -1562,11 +1562,11 @@
pos.lnum = c;
pos.col = 0;
- retval = 2; /* pattern found, line offset added */
+ retval = 2; // pattern found, line offset added
}
- else if (pos.col < MAXCOL - 2) /* just in case */
+ else if (pos.col < MAXCOL - 2) // just in case
{
- /* to the right, check for end of file */
+ // to the right, check for end of file
c = spats[0].off.off;
if (c > 0)
{
@@ -1574,7 +1574,7 @@
if (incl(&pos) == -1)
break;
}
- /* to the left, check for start of file */
+ // to the left, check for start of file
else
{
while (c++ < 0)
@@ -1692,16 +1692,16 @@
p = skipwhite(ptr);
pos->col = (colnr_T) (p - ptr);
- /* when adding lines the matching line may be empty but it is not
- * ignored because we are interested in the next line -- Acevedo */
+ // when adding lines the matching line may be empty but it is not
+ // ignored because we are interested in the next line -- Acevedo
if ((compl_cont_status & CONT_ADDING)
&& !(compl_cont_status & CONT_SOL))
{
if ((p_ic ? MB_STRICMP(p, pat) : STRCMP(p, pat)) == 0)
return OK;
}
- else if (*p != NUL) /* ignore empty lines */
- { /* expanding lines or words */
+ else if (*p != NUL) // ignore empty lines
+ { // expanding lines or words
if ((p_ic ? MB_STRNICMP(p, pat, compl_length)
: STRNCMP(p, pat, compl_length)) == 0)
return OK;
@@ -1723,17 +1723,17 @@
int
searchc(cmdarg_T *cap, int t_cmd)
{
- int c = cap->nchar; /* char to search for */
- int dir = cap->arg; /* TRUE for searching forward */
- long count = cap->count1; /* repeat count */
+ int c = cap->nchar; // char to search for
+ int dir = cap->arg; // TRUE for searching forward
+ long count = cap->count1; // repeat count
int col;
char_u *p;
int len;
int stop = TRUE;
- if (c != NUL) /* normal search: remember args for repeat */
+ if (c != NUL) // normal search: remember args for repeat
{
- if (!KeyStuffed) /* don't remember when redoing */
+ if (!KeyStuffed) // don't remember when redoing
{
*lastc = c;
set_csearch_direction(dir);
@@ -1749,21 +1749,21 @@
}
}
}
- else /* repeat previous search */
+ else // repeat previous search
{
if (*lastc == NUL && lastc_bytelen == 1)
return FAIL;
- if (dir) /* repeat in opposite direction */
+ if (dir) // repeat in opposite direction
dir = -lastcdir;
else
dir = lastcdir;
t_cmd = last_t_cmd;
c = *lastc;
- /* For multi-byte re-use last lastc_bytes[] and lastc_bytelen. */
+ // For multi-byte re-use last lastc_bytes[] and lastc_bytelen.
- /* Force a move of at least one char, so ";" and "," will move the
- * cursor, even if the cursor is right in front of char we are looking
- * at. */
+ // Force a move of at least one char, so ";" and "," will move the
+ // cursor, even if the cursor is right in front of char we are looking
+ // at.
if (vim_strchr(p_cpo, CPO_SCOLON) == NULL && count == 1 && t_cmd)
stop = FALSE;
}
@@ -1821,15 +1821,15 @@
if (t_cmd)
{
- /* backup to before the character (possibly double-byte) */
+ // backup to before the character (possibly double-byte)
col -= dir;
if (has_mbyte)
{
if (dir < 0)
- /* Landed on the search char which is lastc_bytelen long */
+ // Landed on the search char which is lastc_bytelen long
col += lastc_bytelen - 1;
else
- /* To previous char, which may be multi-byte. */
+ // To previous char, which may be multi-byte.
col -= (*mb_head_off)(p, p + col);
}
}
@@ -2041,31 +2041,31 @@
int flags,
int maxtravel)
{
- static pos_T pos; /* current search position */
- int findc = 0; /* matching brace */
+ static pos_T pos; // current search position
+ int findc = 0; // matching brace
int c;
- int count = 0; /* cumulative number of braces */
- int backwards = FALSE; /* init for gcc */
- int raw_string = FALSE; /* search for raw string */
- int inquote = FALSE; /* TRUE when inside quotes */
- char_u *linep; /* pointer to current line */
+ int count = 0; // cumulative number of braces
+ int backwards = FALSE; // init for gcc
+ int raw_string = FALSE; // search for raw string
+ int inquote = FALSE; // TRUE when inside quotes
+ char_u *linep; // pointer to current line
char_u *ptr;
- int do_quotes; /* check for quotes in current line */
- int at_start; /* do_quotes value at start position */
- int hash_dir = 0; /* Direction searched for # things */
- int comment_dir = 0; /* Direction searched for comments */
- pos_T match_pos; /* Where last slash-star was found */
- int start_in_quotes; /* start position is in quotes */
- int traveled = 0; /* how far we've searched so far */
- int ignore_cend = FALSE; /* ignore comment end */
- int cpo_match; /* vi compatible matching */
- int cpo_bsl; /* don't recognize backslashes */
- int match_escaped = 0; /* search for escaped match */
- int dir; /* Direction to search */
- int comment_col = MAXCOL; /* start of / / comment */
+ int do_quotes; // check for quotes in current line
+ int at_start; // do_quotes value at start position
+ int hash_dir = 0; // Direction searched for # things
+ int comment_dir = 0; // Direction searched for comments
+ pos_T match_pos; // Where last slash-star was found
+ int start_in_quotes; // start position is in quotes
+ int traveled = 0; // how far we've searched so far
+ int ignore_cend = FALSE; // ignore comment end
+ int cpo_match; // vi compatible matching
+ int cpo_bsl; // don't recognize backslashes
+ int match_escaped = 0; // search for escaped match
+ int dir; // Direction to search
+ int comment_col = MAXCOL; // start of / / comment
#ifdef FEAT_LISP
- int lispcomm = FALSE; /* inside of Lisp-style comment */
- int lisp = curbuf->b_p_lisp; /* engage Lisp-specific hacks ;) */
+ int lispcomm = FALSE; // inside of Lisp-style comment
+ int lisp = curbuf->b_p_lisp; // engage Lisp-specific hacks ;)
#endif
pos = curwin->w_cursor;
@@ -2075,7 +2075,7 @@
cpo_match = (vim_strchr(p_cpo, CPO_MATCH) != NULL);
cpo_bsl = (vim_strchr(p_cpo, CPO_MATCHBSL) != NULL);
- /* Direction to search when initc is '/', '*' or '#' */
+ // Direction to search when initc is '/', '*' or '#'
if (flags & FM_BACKWARD)
dir = BACKWARD;
else if (flags & FM_FORWARD)
@@ -2123,7 +2123,7 @@
*/
if (!cpo_match)
{
- /* Are we before or at #if, #else etc.? */
+ // Are we before or at #if, #else etc.?
ptr = skipwhite(linep);
if (*ptr == '#' && pos.col <= (colnr_T)(ptr - linep))
{
@@ -2134,7 +2134,7 @@
hash_dir = 1;
}
- /* Are we on a comment? */
+ // Are we on a comment?
else if (linep[pos.col] == '/')
{
if (linep[pos.col + 1] == '*')
@@ -2191,7 +2191,7 @@
}
if (!findc)
{
- /* no brace in the line, maybe use " #if" then */
+ // no brace in the line, maybe use " #if" then
if (!cpo_match && *skipwhite(linep) == '#')
hash_dir = 1;
else
@@ -2201,8 +2201,8 @@
{
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++;
match_escaped = (bslcnt & 1);
@@ -2215,7 +2215,7 @@
* Look for matching #if, #else, #elif, or #endif
*/
if (oap != NULL)
- oap->motion_type = MLINE; /* Linewise for this case only */
+ oap->motion_type = MLINE; // Linewise for this case only
if (initc != '#')
{
ptr = skipwhite(skipwhite(linep) + 1);
@@ -2238,7 +2238,7 @@
break;
pos.lnum += hash_dir;
linep = ml_get(pos.lnum);
- line_breakcheck(); /* check for CTRL-C typed */
+ line_breakcheck(); // check for CTRL-C typed
ptr = skipwhite(linep);
if (*ptr != '#')
continue;
@@ -2282,8 +2282,8 @@
}
#ifdef FEAT_RIGHTLEFT
- /* This is just guessing: when 'rightleft' is set, search for a matching
- * paren/brace in the other direction. */
+ // This is just guessing: when 'rightleft' is set, search for a matching
+ // paren/brace in the other direction.
if (curwin->w_p_rl && vim_strchr((char_u *)"()[]{}<>", initc) != NULL)
backwards = !backwards;
#endif
@@ -2292,7 +2292,7 @@
start_in_quotes = MAYBE;
CLEAR_POS(&match_pos);
- /* backward search: Check if this line contains a single-line comment */
+ // backward search: Check if this line contains a single-line comment
if ((backwards && comment_dir)
#ifdef FEAT_LISP
|| lisp
@@ -2301,7 +2301,7 @@
comment_col = check_linecomment(linep);
#ifdef FEAT_LISP
if (lisp && comment_col != MAXCOL && pos.col > (colnr_T)comment_col)
- lispcomm = TRUE; /* find match inside this comment */
+ lispcomm = TRUE; // find match inside this comment
#endif
while (!got_int)
{
@@ -2312,13 +2312,13 @@
if (backwards)
{
#ifdef FEAT_LISP
- /* char to match is inside of comment, don't search outside */
+ // char to match is inside of comment, don't search outside
if (lispcomm && pos.col < (colnr_T)comment_col)
break;
#endif
- if (pos.col == 0) /* at start of line, go to prev. one */
+ if (pos.col == 0) // at start of line, go to prev. one
{
- if (pos.lnum == 1) /* start of file */
+ if (pos.lnum == 1) // start of file
break;
--pos.lnum;
@@ -2326,11 +2326,11 @@
break;
linep = ml_get(pos.lnum);
- pos.col = (colnr_T)STRLEN(linep); /* pos.col on trailing NUL */
+ pos.col = (colnr_T)STRLEN(linep); // pos.col on trailing NUL
do_quotes = -1;
line_breakcheck();
- /* Check if this line contains a single-line comment */
+ // Check if this line contains a single-line comment
if (comment_dir
#ifdef FEAT_LISP
|| lisp
@@ -2338,7 +2338,7 @@
)
comment_col = check_linecomment(linep);
#ifdef FEAT_LISP
- /* skip comment */
+ // skip comment
if (lisp && comment_col != MAXCOL)
pos.col = comment_col;
#endif
@@ -2350,21 +2350,21 @@
pos.col -= (*mb_head_off)(linep, linep + pos.col);
}
}
- else /* forward search */
+ else // forward search
{
if (linep[pos.col] == NUL
- /* at end of line, go to next one */
+ // at end of line, go to next one
#ifdef FEAT_LISP
- /* don't search for match in comment */
+ // don't search for match in comment
|| (lisp && comment_col != MAXCOL
&& pos.col == (colnr_T)comment_col)
#endif
)
{
- if (pos.lnum == curbuf->b_ml.ml_line_count /* end of file */
+ if (pos.lnum == curbuf->b_ml.ml_line_count // end of file
#ifdef FEAT_LISP
- /* 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
#endif
)
@@ -2379,7 +2379,7 @@
do_quotes = -1;
line_breakcheck();
#ifdef FEAT_LISP
- if (lisp) /* find comment pos in new line */
+ if (lisp) // find comment pos in new line
comment_col = check_linecomment(linep);
#endif
}
@@ -2398,15 +2398,15 @@
if (pos.col == 0 && (flags & FM_BLOCKSTOP) &&
(linep[0] == '{' || linep[0] == '}'))
{
- if (linep[0] == findc && count == 0) /* match! */
+ if (linep[0] == findc && count == 0) // match!
return &pos;
- break; /* out of scope */
+ break; // out of scope
}
if (comment_dir)
{
- /* Note: comments do not nest, and we ignore quotes in them */
- /* TODO: ignore comment brackets inside strings */
+ // Note: comments do not nest, and we ignore quotes in them
+ // TODO: ignore comment brackets inside strings
if (comment_dir == FORWARD)
{
if (linep[pos.col] == '*' && linep[pos.col + 1] == '/')
@@ -2415,7 +2415,7 @@
return &pos;
}
}
- else /* Searching backwards */
+ else // Searching backwards
{
/*
* A comment may contain / * or / /, it may also start or end
@@ -2429,10 +2429,10 @@
&& linep[pos.col] == '"'
&& vim_strchr(linep + pos.col + 1, '(') != NULL)
{
- /* Possible start of raw string. Now that we have the
- * delimiter we can check if it ends before where we
- * started searching, or before the previously found
- * raw string start. */
+ // Possible start of raw string. Now that we have the
+ // delimiter we can check if it ends before where we
+ // started searching, or before the previously found
+ // raw string start.
if (!find_rawstring_end(linep, &pos,
count > 0 ? &match_pos : &curwin->w_cursor))
{
@@ -2440,7 +2440,7 @@
match_pos = pos;
match_pos.col--;
}
- linep = ml_get(pos.lnum); /* may have been released */
+ linep = ml_get(pos.lnum); // may have been released
}
}
else if ( linep[pos.col - 1] == '/'
@@ -2493,7 +2493,7 @@
if (*ptr == '\\' && ptr[1] != NUL)
++ptr;
}
- do_quotes &= 1; /* result is 1 with even number of quotes */
+ do_quotes &= 1; // result is 1 with even number of quotes
/*
* If we find an uneven count, check current line and previous
@@ -2507,7 +2507,7 @@
do_quotes = 1;
if (start_in_quotes == MAYBE)
{
- /* Do we need to use at_start here? */
+ // Do we need to use at_start here?
inquote = TRUE;
start_in_quotes = TRUE;
}
@@ -2530,7 +2530,7 @@
inquote = TRUE;
}
- /* ml_get() only keeps one line, need to get linep again */
+ // ml_get() only keeps one line, need to get linep again
linep = ml_get(pos.lnum);
}
}
@@ -2553,7 +2553,7 @@
switch (c)
{
case NUL:
- /* at end of line without trailing backslash, reset inquote */
+ // at end of line without trailing backslash, reset inquote
if (pos.col == 0 || linep[pos.col - 1] != '\\')
{
inquote = FALSE;
@@ -2562,8 +2562,8 @@
break;
case '"':
- /* a quote that is preceded with an odd number of backslashes is
- * ignored */
+ // a quote that is preceded with an odd number of backslashes is
+ // ignored
if (do_quotes)
{
int col;
@@ -2606,7 +2606,7 @@
}
}
}
- else if (linep[pos.col + 1]) /* forward search */
+ else if (linep[pos.col + 1]) // forward search
{
if (linep[pos.col + 1] == '\\' &&
linep[pos.col + 2] && linep[pos.col + 3] == '\'')
@@ -2621,7 +2621,7 @@
}
}
}
- /* FALLTHROUGH */
+ // FALLTHROUGH
default:
#ifdef FEAT_LISP
@@ -2637,8 +2637,8 @@
break;
#endif
- /* 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 == TRUE)
&& (c == initc || c == findc))
{
@@ -2649,8 +2649,8 @@
for (col = pos.col; check_prevcol(linep, col, '\\', &col);)
bslcnt++;
}
- /* Only accept a match when 'M' is in 'cpo' or when escaping
- * is what we expect. */
+ // Only accept a match when 'M' is in 'cpo' or when escaping
+ // is what we expect.
if (cpo_bsl || (bslcnt & 1) == match_escaped)
{
if (c == initc)
@@ -2671,7 +2671,7 @@
pos = match_pos;
return &pos;
}
- return (pos_T *)NULL; /* never found it */
+ return (pos_T *)NULL; // never found it
}
/*
@@ -2686,31 +2686,31 @@
p = line;
#ifdef FEAT_LISP
- /* skip Lispish one-line comments */
+ // skip Lispish one-line comments
if (curbuf->b_p_lisp)
{
- if (vim_strchr(p, ';') != NULL) /* there may be comments */
+ if (vim_strchr(p, ';') != NULL) // there may be comments
{
- int in_str = FALSE; /* inside of string */
+ int in_str = FALSE; // inside of string
- p = line; /* scan from start */
+ p = line; // scan from start
while ((p = vim_strpbrk(p, (char_u *)"\";")) != NULL)
{
if (*p == '"')
{
if (in_str)
{
- if (*(p - 1) != '\\') /* skip escaped quote */
+ if (*(p - 1) != '\\') // skip escaped quote
in_str = FALSE;
}
else if (p == line || ((p - line) >= 2
- /* skip #\" form */
+ // skip #\" form
&& *(p - 1) != '\\' && *(p - 2) != '#'))
in_str = TRUE;
}
else if (!in_str && ((p - line) < 2
|| (*(p - 1) != '\\' && *(p - 2) != '#')))
- break; /* found! */
+ break; // found!
++p;
}
}
@@ -2721,8 +2721,8 @@
#endif
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;
++p;
@@ -2741,7 +2741,7 @@
*/
void
showmatch(
- int c) /* char to show match for */
+ int c) // char to show match for
{
pos_T *lpos, save_cursor;
pos_T mpos;
@@ -2759,7 +2759,7 @@
/*
* Only show match for chars in the 'matchpairs' option.
*/
- /* 'matchpairs' is "x:y,x:y" */
+ // 'matchpairs' is "x:y,x:y"
for (p = curbuf->b_p_mps; *p != NUL; ++p)
{
#ifdef FEAT_RIGHTLEFT
@@ -2778,7 +2778,7 @@
return;
}
- if ((lpos = findmatch(NULL, NUL)) == NULL) /* no match, so beep */
+ if ((lpos = findmatch(NULL, NUL)) == NULL) // no match, so beep
vim_beep(BO_MATCH);
else if (lpos->lnum >= curwin->w_topline && lpos->lnum < curwin->w_botline)
{
@@ -2787,34 +2787,34 @@
if (curwin->w_p_wrap || (vcol >= curwin->w_leftcol
&& vcol < curwin->w_leftcol + curwin->w_width))
{
- mpos = *lpos; /* save the pos, update_screen() may change it */
+ mpos = *lpos; // save the pos, update_screen() may change it
save_cursor = curwin->w_cursor;
save_so = *so;
save_siso = *siso;
- /* Handle "$" in 'cpo': If the ')' is typed on top of the "$",
- * stop displaying the "$". */
+ // Handle "$" in 'cpo': If the ')' is typed on top of the "$",
+ // stop displaying the "$".
if (dollar_vcol >= 0 && dollar_vcol == curwin->w_virtcol)
dollar_vcol = -1;
- ++curwin->w_virtcol; /* do display ')' just before "$" */
- update_screen(VALID); /* show the new char first */
+ ++curwin->w_virtcol; // do display ')' just before "$"
+ update_screen(VALID); // show the new char first
save_dollar_vcol = dollar_vcol;
#ifdef CURSOR_SHAPE
save_state = State;
State = SHOWMATCH;
- ui_cursor_shape(); /* may show different cursor shape */
+ ui_cursor_shape(); // may show different cursor shape
#endif
- curwin->w_cursor = mpos; /* move to matching char */
- *so = 0; /* don't use 'scrolloff' here */
- *siso = 0; /* don't use 'sidescrolloff' here */
+ curwin->w_cursor = mpos; // move to matching char
+ *so = 0; // don't use 'scrolloff' here
+ *siso = 0; // don't use 'sidescrolloff' here
showruler(FALSE);
setcursor();
- cursor_on(); /* make sure that the cursor is shown */
+ cursor_on(); // make sure that the cursor is shown
out_flush_cursor(TRUE, FALSE);
- /* 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;
/*
@@ -2825,12 +2825,12 @@
ui_delay(p_mat * 100L + 8, TRUE);
else if (!char_avail())
ui_delay(p_mat * 100L + 9, FALSE);
- curwin->w_cursor = save_cursor; /* restore cursor position */
+ curwin->w_cursor = save_cursor; // restore cursor position
*so = save_so;
*siso = save_siso;
#ifdef CURSOR_SHAPE
State = save_state;
- ui_cursor_shape(); /* may show different cursor shape */
+ ui_cursor_shape(); // may show different cursor shape
#endif
}
}
@@ -2850,7 +2850,7 @@
int c;
int (*func)(pos_T *);
int startlnum;
- int noskip = FALSE; /* do not skip blanks */
+ int noskip = FALSE; // do not skip blanks
int cpo_J;
int found_dot;
@@ -2910,11 +2910,11 @@
decl(&pos);
}
- /* remember the line where the search started */
+ // remember the line where the search started
startlnum = pos.lnum;
cpo_J = vim_strchr(p_cpo, CPO_ENDOFSENT) != NULL;
- for (;;) /* find end of sentence */
+ for (;;) // find end of sentence
{
c = gchar_pos(&pos);
if (c == NUL || (pos.col == 0 && startPS(pos.lnum, NUL, FALSE)))
@@ -2936,7 +2936,7 @@
&& gchar_pos(&tpos) == ' ')))
{
pos = tpos;
- if (gchar_pos(&pos) == NUL) /* skip NUL at EOL */
+ if (gchar_pos(&pos) == NUL) // skip NUL at EOL
inc(&pos);
break;
}
@@ -2950,7 +2950,7 @@
}
}
found:
- /* skip white space */
+ // skip white space
while (!noskip && ((c = gchar_pos(&pos)) == ' ' || c == '\t'))
if (incl(&pos) == -1)
break;
@@ -2971,21 +2971,21 @@
*/
int
findpar(
- int *pincl, /* Return: TRUE if last char is to be included */
+ int *pincl, // Return: TRUE if last char is to be included
int dir,
long count,
int what,
int both)
{
linenr_T curr;
- int did_skip; /* TRUE after separating lines have been skipped */
- int first; /* TRUE on first line */
+ int did_skip; // TRUE after separating lines have been skipped
+ int first; // TRUE on first line
int posix = (vim_strchr(p_cpo, CPO_PARA) != NULL);
#ifdef FEAT_FOLDING
- linenr_T fold_first; /* first line of a closed fold */
- linenr_T fold_last; /* last line of a closed fold */
- int fold_skipped; /* TRUE if a closed fold was skipped this
- iteration */
+ linenr_T fold_first; // first line of a closed fold
+ linenr_T fold_last; // last line of a closed fold
+ int fold_skipped; // TRUE if a closed fold was skipped this
+ // iteration
#endif
curr = curwin->w_cursor.lnum;
@@ -2999,7 +2999,7 @@
did_skip = TRUE;
#ifdef FEAT_FOLDING
- /* skip folded lines */
+ // skip folded lines
fold_skipped = FALSE;
if (first && hasFolding(curr, &fold_first, &fold_last))
{
@@ -3008,9 +3008,9 @@
}
#endif
- /* POSIX has its own ideas of what a paragraph boundary is and it
- * doesn't match historical Vi: It also stops at a "{" in the
- * first column and at an empty line. */
+ // POSIX has its own ideas of what a paragraph boundary is and it
+ // doesn't match historical Vi: It also stops at a "{" in the
+ // first column and at an empty line.
if (!first && did_skip && (startPS(curr, what, both)
|| (posix && what == NUL && *ml_get(curr) == '{')))
break;
@@ -3029,15 +3029,15 @@
}
}
setpcmark();
- if (both && *ml_get(curr) == '}') /* include line with '}' */
+ if (both && *ml_get(curr) == '}') // include line with '}'
++curr;
curwin->w_cursor.lnum = curr;
if (curr == curbuf->b_ml.ml_line_count && what != '}')
{
char_u *line = ml_get(curr);
- /* Put the cursor on the last character in the last line and make the
- * motion inclusive. */
+ // Put the cursor on the last character in the last line and make the
+ // motion inclusive.
if ((curwin->w_cursor.col = (colnr_T)STRLEN(line)) != 0)
{
--curwin->w_cursor.col;
@@ -3061,9 +3061,9 @@
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. */
+ // 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] == ' ')))
@@ -3113,7 +3113,7 @@
* 2 or higher - keyword characters (letters, digits and underscore)
*/
-static int cls_bigword; /* TRUE for "W", "B" or "E" */
+static int cls_bigword; // TRUE for "W", "B" or "E"
/*
* cls() - returns the class of character at curwin->w_cursor
@@ -3132,11 +3132,11 @@
return 0;
if (enc_dbcs != 0 && c > 0xFF)
{
- /* If cls_bigword, report multi-byte chars as class 1. */
+ // If cls_bigword, report multi-byte chars as class 1.
if (enc_dbcs == DBCS_KOR && cls_bigword)
return 1;
- /* process code leading/trailing bytes */
+ // process code leading/trailing bytes
return dbcs_class(((unsigned)c >> 8), (c & 0xFF));
}
if (enc_utf8)
@@ -3147,7 +3147,7 @@
return c;
}
- /* If cls_bigword is TRUE, report all non-blanks as class 1. */
+ // If cls_bigword is TRUE, report all non-blanks as class 1.
if (cls_bigword)
return 1;
@@ -3166,10 +3166,10 @@
int
fwd_word(
long count,
- int bigword, /* "W", "E" or "B" */
+ int bigword, // "W", "E" or "B"
int eol)
{
- int sclass; /* starting class */
+ int sclass; // starting class
int i;
int last_line;
@@ -3178,8 +3178,8 @@
while (--count >= 0)
{
#ifdef FEAT_FOLDING
- /* 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((colnr_T)MAXCOL);
#endif
@@ -3191,9 +3191,9 @@
*/
last_line = (curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count);
i = inc_cursor();
- if (i == -1 || (i >= 1 && last_line)) /* started at last char in file */
+ if (i == -1 || (i >= 1 && last_line)) // started at last char in file
return FAIL;
- if (i >= 1 && eol && count == 0) /* started at last char in line */
+ if (i >= 1 && eol && count == 0) // started at last char in line
return OK;
/*
@@ -3236,20 +3236,20 @@
int
bck_word(long count, int bigword, int stop)
{
- int sclass; /* starting class */
+ int sclass; // starting class
curwin->w_cursor.coladd = 0;
cls_bigword = bigword;
while (--count >= 0)
{
#ifdef FEAT_FOLDING
- /* When inside a range of folded lines, move to the first char of the
- * first line. */
+ // When inside a range of folded lines, move to the first char of the
+ // first line.
if (hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL))
curwin->w_cursor.col = 0;
#endif
sclass = cls();
- if (dec_cursor() == -1) /* started at start of file */
+ if (dec_cursor() == -1) // started at start of file
return FAIL;
if (!stop || sclass == cls() || sclass == 0)
@@ -3263,7 +3263,7 @@
if (curwin->w_cursor.col == 0
&& LINEEMPTY(curwin->w_cursor.lnum))
goto finished;
- if (dec_cursor() == -1) /* hit start of file, stop here */
+ if (dec_cursor() == -1) // hit start of file, stop here
return OK;
}
@@ -3274,7 +3274,7 @@
return OK;
}
- inc_cursor(); /* overshot - forward one */
+ inc_cursor(); // overshot - forward one
finished:
stop = FALSE;
}
@@ -3303,15 +3303,15 @@
int stop,
int empty)
{
- int sclass; /* starting class */
+ int sclass; // starting class
curwin->w_cursor.coladd = 0;
cls_bigword = bigword;
while (--count >= 0)
{
#ifdef FEAT_FOLDING
- /* 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((colnr_T)MAXCOL);
#endif
@@ -3342,7 +3342,7 @@
if (empty && curwin->w_cursor.col == 0
&& LINEEMPTY(curwin->w_cursor.lnum))
goto finished;
- if (inc_cursor() == -1) /* hit end of file, stop here */
+ if (inc_cursor() == -1) // hit end of file, stop here
return FAIL;
}
@@ -3352,9 +3352,9 @@
if (skip_chars(cls(), FORWARD))
return FAIL;
}
- dec_cursor(); /* overshot - one char backward */
+ dec_cursor(); // overshot - one char backward
finished:
- stop = FALSE; /* we move only one word less */
+ stop = FALSE; // we move only one word less
}
return OK;
}
@@ -3367,10 +3367,10 @@
int
bckend_word(
long count,
- int bigword, /* TRUE for "B" */
- int eol) /* TRUE: stop at end of line. */
+ int bigword, // TRUE for "B"
+ int eol) // TRUE: stop at end of line.
{
- int sclass; /* starting class */
+ int sclass; // starting class
int i;
curwin->w_cursor.coladd = 0;
@@ -3427,15 +3427,15 @@
static void
back_in_line(void)
{
- int sclass; /* starting class */
+ int sclass; // starting class
sclass = cls();
for (;;)
{
- if (curwin->w_cursor.col == 0) /* stop at start of line */
+ if (curwin->w_cursor.col == 0) // stop at start of line
break;
dec_cursor();
- if (cls() != sclass) /* stop at start of word */
+ if (cls() != sclass) // stop at start of word
{
inc_cursor();
break;
@@ -3465,7 +3465,7 @@
static void
findsent_forward(
long count,
- int at_start_sent) /* cursor is at start of sentence */
+ int at_start_sent) // cursor is at start of sentence
{
while (count--)
{
@@ -3486,8 +3486,8 @@
current_word(
oparg_T *oap,
long count,
- int include, /* TRUE: include word and white space */
- int bigword) /* FALSE == word, TRUE == WORD */
+ int include, // TRUE: include word and white space
+ int bigword) // FALSE == word, TRUE == WORD
{
pos_T start_pos;
pos_T pos;
@@ -3497,7 +3497,7 @@
cls_bigword = bigword;
CLEAR_POS(&start_pos);
- /* Correct cursor when 'selection' is exclusive */
+ // Correct cursor when 'selection' is exclusive
if (VIsual_active && *p_sel == 'e' && LT_POS(VIsual, curwin->w_cursor))
dec_cursor();
@@ -3544,9 +3544,9 @@
if (VIsual_active)
{
- /* should do something when inclusive == FALSE ! */
+ // should do something when inclusive == FALSE !
VIsual = start_pos;
- redraw_curbuf_later(INVERTED); /* update the inversion */
+ redraw_curbuf_later(INVERTED); // update the inversion
}
else
{
@@ -3620,7 +3620,7 @@
* (cursor is at start of next line).
* But don't delete white space at start of line (indent).
*/
- pos = curwin->w_cursor; /* save cursor position */
+ pos = curwin->w_cursor; // save cursor position
curwin->w_cursor = start_pos;
if (oneleft() == OK)
{
@@ -3633,7 +3633,7 @@
oap->start = curwin->w_cursor;
}
}
- curwin->w_cursor = pos; /* put cursor back at end */
+ curwin->w_cursor = pos; // put cursor back at end
}
if (VIsual_active)
@@ -3643,7 +3643,7 @@
if (VIsual_mode == 'V')
{
VIsual_mode = 'v';
- redraw_cmdline = TRUE; /* show mode later */
+ redraw_cmdline = TRUE; // show mode later
}
}
else
@@ -3668,7 +3668,7 @@
start_pos = curwin->w_cursor;
pos = start_pos;
- findsent(FORWARD, 1L); /* Find start of next sentence. */
+ findsent(FORWARD, 1L); // Find start of next sentence.
/*
* When the Visual area is bigger than one character: Extend it.
@@ -3701,12 +3701,12 @@
{
findsent(BACKWARD, 1L);
if (EQUAL_POS(curwin->w_cursor, start_pos))
- at_start_sent = TRUE; /* exactly at start of sentence */
+ at_start_sent = TRUE; // exactly at start of sentence
else
- /* inside a sentence, go to its end (start of next) */
+ // inside a sentence, go to its end (start of next)
findsent(FORWARD, 1L);
}
- if (include) /* "as" gets twice as much as "is" */
+ if (include) // "as" gets twice as much as "is"
count *= 2;
while (count--)
{
@@ -3729,7 +3729,7 @@
*/
incl(&pos);
at_start_sent = TRUE;
- /* not just before a sentence */
+ // not just before a sentence
if (!EQUAL_POS(pos, curwin->w_cursor))
{
at_start_sent = FALSE;
@@ -3743,13 +3743,13 @@
}
incl(&pos);
}
- if (at_start_sent) /* in the sentence */
+ if (at_start_sent) // in the sentence
findsent(BACKWARD, 1L);
- else /* in/before white before a sentence */
+ else // in/before white before a sentence
curwin->w_cursor = start_pos;
}
- if (include) /* "as" gets twice as much as "is" */
+ if (include) // "as" gets twice as much as "is"
count *= 2;
findsent_forward(count, at_start_sent);
if (*p_sel == 'e')
@@ -3762,12 +3762,12 @@
* If the cursor started on a blank, check if it is just before the start
* of the next sentence.
*/
- while (c = gchar_pos(&pos), VIM_ISWHITE(c)) /* VIM_ISWHITE() is a macro */
+ while (c = gchar_pos(&pos), VIM_ISWHITE(c)) // VIM_ISWHITE() is a macro
incl(&pos);
if (EQUAL_POS(pos, curwin->w_cursor))
{
start_blank = TRUE;
- find_first_blank(&start_pos); /* go back to first blank */
+ find_first_blank(&start_pos); // go back to first blank
}
else
{
@@ -3798,7 +3798,7 @@
if (start_blank)
{
find_first_blank(&curwin->w_cursor);
- c = gchar_pos(&curwin->w_cursor); /* VIM_ISWHITE() is a macro */
+ c = gchar_pos(&curwin->w_cursor); // VIM_ISWHITE() is a macro
if (VIM_ISWHITE(c))
decl(&curwin->w_cursor);
}
@@ -3808,19 +3808,19 @@
if (VIsual_active)
{
- /* Avoid getting stuck with "is" on a single space before a sentence. */
+ // Avoid getting stuck with "is" on a single space before a sentence.
if (EQUAL_POS(start_pos, curwin->w_cursor))
goto extend;
if (*p_sel == 'e')
++curwin->w_cursor.col;
VIsual = start_pos;
VIsual_mode = 'v';
- redraw_cmdline = TRUE; /* show mode later */
- redraw_curbuf_later(INVERTED); /* update the inversion */
+ redraw_cmdline = TRUE; // show mode later
+ redraw_curbuf_later(INVERTED); // update the inversion
}
else
{
- /* include a newline after the sentence, if there is one */
+ // include a newline after the sentence, if there is one
if (incl(&curwin->w_cursor) == -1)
oap->inclusive = TRUE;
else
@@ -3839,9 +3839,9 @@
current_block(
oparg_T *oap,
long count,
- int include, /* TRUE == include white space */
- int what, /* '(', '{', etc. */
- int other) /* ')', '}', etc. */
+ int include, // TRUE == include white space
+ int what, // '(', '{', etc.
+ int other) // ')', '}', etc.
{
pos_T old_pos;
pos_T *pos = NULL;
@@ -3849,10 +3849,10 @@
pos_T *end_pos;
pos_T old_start, old_end;
char_u *save_cpo;
- int sol = FALSE; /* '{' at start of line */
+ int sol = FALSE; // '{' at start of line
old_pos = curwin->w_cursor;
- old_end = curwin->w_cursor; /* remember where we started */
+ old_end = curwin->w_cursor; // remember where we started
old_start = old_end;
/*
@@ -3861,18 +3861,18 @@
if (!VIsual_active || EQUAL_POS(VIsual, curwin->w_cursor))
{
setpcmark();
- if (what == '{') /* ignore indent */
+ if (what == '{') // ignore indent
while (inindent(1))
if (inc_cursor() != 0)
break;
if (gchar_cursor() == what)
- /* cursor on '(' or '{', move cursor just after it */
+ // cursor on '(' or '{', move cursor just after it
++curwin->w_cursor.col;
}
else if (LT_POS(VIsual, curwin->w_cursor))
{
old_start = VIsual;
- curwin->w_cursor = VIsual; /* cursor at low end of Visual */
+ curwin->w_cursor = VIsual; // cursor at low end of Visual
}
else
old_end = VIsual;
@@ -3890,7 +3890,7 @@
if ((pos = findmatch(NULL, what)) == NULL)
break;
curwin->w_cursor = *pos;
- start_pos = *pos; /* the findmatch for end_pos will overwrite *pos */
+ start_pos = *pos; // the findmatch for end_pos will overwrite *pos
}
p_cpo = save_cpo;
@@ -3955,10 +3955,10 @@
if (*p_sel == 'e')
inc(&curwin->w_cursor);
if (sol && gchar_cursor() != NUL)
- inc(&curwin->w_cursor); /* include the line break */
+ inc(&curwin->w_cursor); // include the line break
VIsual = start_pos;
VIsual_mode = 'v';
- redraw_curbuf_later(INVERTED); /* update the inversion */
+ redraw_curbuf_later(INVERTED); // update the inversion
showmode();
}
else
@@ -3969,11 +3969,11 @@
if (sol)
incl(&curwin->w_cursor);
else if (LTOREQ_POS(start_pos, curwin->w_cursor))
- /* Include the character under the cursor. */
+ // Include the character under the cursor.
oap->inclusive = TRUE;
else
- /* End is before the start (no text in between <>, [], etc.): don't
- * operate on any text. */
+ // End is before the start (no text in between <>, [], etc.): don't
+ // operate on any text.
curwin->w_cursor = start_pos;
}
@@ -3998,15 +3998,15 @@
{
char_u *lp = NULL;
- /* We search forward until the cursor, because searching backwards is
- * very slow for DBCS encodings. */
+ // We search forward until the cursor, because searching backwards is
+ // very slow for DBCS encodings.
for (p = line; p < line + curwin->w_cursor.col; MB_PTR_ADV(p))
if (*p == '>' || *p == '<')
{
lc = *p;
lp = p;
}
- if (*p != '<') /* check for '<' under cursor */
+ if (*p != '<') // check for '<' under cursor
{
if (lc != '<')
return FALSE;
@@ -4017,10 +4017,10 @@
{
for (p = line + curwin->w_cursor.col; p > line; )
{
- if (*p == '<') /* find '<' under/before cursor */
+ if (*p == '<') // find '<' under/before cursor
break;
MB_PTR_BACK(line, p);
- if (*p == '>') /* find '>' before cursor */
+ if (*p == '>') // find '>' before cursor
break;
}
if (*p != '<')
@@ -4032,14 +4032,14 @@
MB_PTR_ADV(p);
if (end_tag)
- /* check that there is a '/' after the '<' */
+ // check that there is a '/' after the '<'
return *p == '/';
- /* check that there is no '/' after the '<' */
+ // check that there is no '/' after the '<'
if (*p == '/')
return FALSE;
- /* check that the matching '>' is not preceded by '/' */
+ // check that the matching '>' is not preceded by '/'
for (;;)
{
if (inc(&pos) < 0)
@@ -4059,7 +4059,7 @@
current_tagblock(
oparg_T *oap,
long count_arg,
- int include) /* TRUE == include white space */
+ int include) // TRUE == include white space
{
long count = count_arg;
long n;
@@ -4080,10 +4080,10 @@
p_ws = FALSE;
old_pos = curwin->w_cursor;
- old_end = curwin->w_cursor; /* remember where we started */
+ old_end = curwin->w_cursor; // remember where we started
old_start = old_end;
if (!VIsual_active || *p_sel == 'e')
- decl(&old_end); /* old_end is inclusive */
+ decl(&old_end); // old_end is inclusive
/*
* If we start on "<aaa>" select that block.
@@ -4092,21 +4092,21 @@
{
setpcmark();
- /* ignore indent */
+ // ignore indent
while (inindent(1))
if (inc_cursor() != 0)
break;
if (in_html_tag(FALSE))
{
- /* cursor on start tag, move to its '>' */
+ // cursor on start tag, move to its '>'
while (*ml_get_cursor() != '>')
if (inc_cursor() < 0)
break;
}
else if (in_html_tag(TRUE))
{
- /* cursor on end tag, move to just before it */
+ // cursor on end tag, move to just before it
while (*ml_get_cursor() != '<')
if (dec_cursor() < 0)
break;
@@ -4117,7 +4117,7 @@
else if (LT_POS(VIsual, curwin->w_cursor))
{
old_start = VIsual;
- curwin->w_cursor = VIsual; /* cursor at low end of Visual */
+ curwin->w_cursor = VIsual; // cursor at low end of Visual
}
else
old_end = VIsual;
@@ -4173,9 +4173,9 @@
if (r < 1 || LT_POS(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;
@@ -4183,7 +4183,7 @@
if (do_include)
{
- /* Include up to the '>'. */
+ // Include up to the '>'.
while (*ml_get_cursor() != '>')
if (inc_cursor() < 0)
break;
@@ -4192,11 +4192,11 @@
{
char_u *c = ml_get_cursor();
- /* Exclude the '<' of the end tag.
- * If the closing tag is on new line, do not decrement cursor, but
- * make operation exclusive, so that the linefeed will be selected */
+ // Exclude the '<' of the end tag.
+ // If the closing tag is on new line, do not decrement cursor, but
+ // make operation exclusive, so that the linefeed will be selected
if (*c == '<' && !VIsual_active && curwin->w_cursor.col == 0)
- /* do not decrement cursor */
+ // do not decrement cursor
is_inclusive = FALSE;
else if (*c == '<')
dec_cursor();
@@ -4205,7 +4205,7 @@
if (!do_include)
{
- /* Exclude the start tag. */
+ // Exclude the start tag.
curwin->w_cursor = start_pos;
while (inc_cursor() >= 0)
if (*ml_get_cursor() == '>')
@@ -4230,15 +4230,15 @@
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_POS(end_pos, start_pos))
curwin->w_cursor = start_pos;
else if (*p_sel == 'e')
inc_cursor();
VIsual = start_pos;
VIsual_mode = 'v';
- redraw_curbuf_later(INVERTED); /* update the inversion */
+ redraw_curbuf_later(INVERTED); // update the inversion
showmode();
}
else
@@ -4247,8 +4247,8 @@
oap->motion_type = MCHAR;
if (LT_POS(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;
}
@@ -4266,8 +4266,8 @@
current_par(
oparg_T *oap,
long count,
- int include, /* TRUE == include white space */
- int type) /* 'p' for paragraph, 'S' for section */
+ int include, // TRUE == include white space
+ int type) // 'p' for paragraph, 'S' for section
{
linenr_T start_lnum;
linenr_T end_lnum;
@@ -4280,7 +4280,7 @@
int t;
int i;
- if (type == 'S') /* not implemented yet */
+ if (type == 'S') // not implemented yet
return FAIL;
start_lnum = curwin->w_cursor.lnum;
@@ -4345,12 +4345,12 @@
white_in_front = linewhite(start_lnum);
while (start_lnum > 1)
{
- if (white_in_front) /* stop at first white line */
+ if (white_in_front) // stop at first white line
{
if (!linewhite(start_lnum - 1))
break;
}
- else /* stop at first non-white line of start of paragraph */
+ else // stop at first non-white line of start of paragraph
{
if (linewhite(start_lnum - 1) || startPS(start_lnum, 0, 0))
break;
@@ -4411,8 +4411,8 @@
if (VIsual_active)
{
- /* Problem: when doing "Vipipip" nothing happens in a single white
- * line, we get stuck there. Trap this here. */
+ // Problem: when doing "Vipipip" nothing happens in a single white
+ // line, we get stuck there. Trap this here.
if (VIsual_mode == 'V' && start_lnum == curwin->w_cursor.lnum)
goto extend;
if (VIsual.lnum != start_lnum)
@@ -4421,7 +4421,7 @@
VIsual.col = 0;
}
VIsual_mode = 'V';
- redraw_curbuf_later(INVERTED); /* update the inversion */
+ redraw_curbuf_later(INVERTED); // update the inversion
showmode();
}
else
@@ -4447,7 +4447,7 @@
char_u *line,
int col,
int quotechar,
- char_u *escape) /* escape characters, can be NULL */
+ char_u *escape) // escape characters, can be NULL
{
int c;
@@ -4479,7 +4479,7 @@
char_u *line,
int col_start,
int quotechar,
- char_u *escape) /* escape characters, can be NULL */
+ char_u *escape) // escape characters, can be NULL
{
int n;
@@ -4493,7 +4493,7 @@
line[col_start - n - 1]) != NULL)
++n;
if (n & 1)
- col_start -= n; /* uneven number of escape chars, skip it */
+ col_start -= n; // uneven number of escape chars, skip it
else if (line[col_start] == quotechar)
break;
}
@@ -4528,7 +4528,7 @@
// The cursor then is moved forward after adjusting the area.
if (VIsual_active)
{
- /* this only works within one line */
+ // this only works within one line
if (VIsual.lnum != curwin->w_cursor.lnum)
return FALSE;
@@ -4562,8 +4562,8 @@
if (!vis_empty)
{
- /* Check if the existing selection exactly spans the text inside
- * quotes. */
+ // Check if the existing selection exactly spans the text inside
+ // quotes.
if (vis_bef_curs)
{
inside_quotes = VIsual.col > 0
@@ -4583,7 +4583,7 @@
col_end = VIsual.col;
}
- /* Find out if we have a quote in the selection. */
+ // Find out if we have a quote in the selection.
while (i <= col_end)
if (line[i++] == quotechar)
{
@@ -4594,12 +4594,12 @@
if (!vis_empty && line[col_start] == quotechar)
{
- /* Already selecting something and on a quote character. Find the
- * next quoted string. */
+ // Already selecting something and on a quote character. Find the
+ // next quoted string.
if (vis_bef_curs)
{
- /* Assume we are on a closing quote: move to after the next
- * opening quote. */
+ // Assume we are on a closing quote: move to after the next
+ // opening quote.
col_start = find_next_quote(line, col_start + 1, quotechar, NULL);
if (col_start < 0)
goto abort_search;
@@ -4607,7 +4607,7 @@
curbuf->b_p_qe);
if (col_end < 0)
{
- /* We were on a starting quote perhaps? */
+ // We were on a starting quote perhaps?
col_end = col_start;
col_start = curwin->w_cursor.col;
}
@@ -4621,7 +4621,7 @@
curbuf->b_p_qe);
if (line[col_start] != quotechar)
{
- /* We were on an ending quote perhaps? */
+ // We were on an ending quote perhaps?
col_start = col_end;
col_end = curwin->w_cursor.col;
}
@@ -4641,24 +4641,24 @@
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. */
+ // Find open quote character.
col_start = find_next_quote(line, col_start, quotechar, NULL);
if (col_start < 0 || col_start > first_col)
goto abort_search;
- /* Find close quote character. */
+ // Find close quote character.
col_end = find_next_quote(line, col_start + 1, quotechar,
curbuf->b_p_qe);
if (col_end < 0)
goto abort_search;
- /* If is cursor between start and end quote character, it is
- * target text object. */
+ // If is cursor between start and end quote character, it is
+ // target text object.
if (col_start <= first_col && first_col <= col_end)
break;
col_start = col_end + 1;
@@ -4666,25 +4666,25 @@
}
else
{
- /* Search backward for a starting quote. */
+ // Search backward for a starting quote.
col_start = find_prev_quote(line, col_start, quotechar, curbuf->b_p_qe);
if (line[col_start] != quotechar)
{
- /* No quote before the cursor, look after the cursor. */
+ // No quote before the cursor, look after the cursor.
col_start = find_next_quote(line, col_start, quotechar, NULL);
if (col_start < 0)
goto abort_search;
}
- /* Find close quote character. */
+ // Find close quote character.
col_end = find_next_quote(line, col_start + 1, quotechar,
curbuf->b_p_qe);
if (col_end < 0)
goto abort_search;
}
- /* When "include" is TRUE, include spaces after closing quote or before
- * the starting quote. */
+ // When "include" is TRUE, include spaces after closing quote or before
+ // the starting quote.
if (include)
{
if (VIM_ISWHITE(line[col_end + 1]))
@@ -4695,17 +4695,16 @@
--col_start;
}
- /* 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
@@ -4724,9 +4723,9 @@
oap->motion_type = MCHAR;
}
- /* Set end position. */
+ // Set end position.
curwin->w_cursor.col = col_end;
- if ((include || count > 1 /* After vi" another i" must include the ". */
+ if ((include || count > 1 // After vi" another i" must include the ".
|| (!vis_empty && inside_quotes)
) && inc_cursor() == 2)
inclusive = TRUE;
@@ -4740,9 +4739,9 @@
}
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
@@ -4757,12 +4756,12 @@
if (VIsual_mode == 'V')
{
VIsual_mode = 'v';
- redraw_cmdline = TRUE; /* show mode later */
+ redraw_cmdline = TRUE; // show mode later
}
}
else
{
- /* Set inclusive and other oap's flags. */
+ // Set inclusive and other oap's flags.
oap->inclusive = inclusive;
}
@@ -4784,7 +4783,7 @@
return FALSE;
}
-#endif /* FEAT_TEXTOBJ */
+#endif // FEAT_TEXTOBJ
/*
* Check if the pattern is zero-width.
@@ -4875,7 +4874,7 @@
pos_T save_VIsual = VIsual;
int zero_width;
- /* Correct cursor when 'selection' is exclusive */
+ // Correct cursor when 'selection' is exclusive
if (VIsual_active && *p_sel == 'e' && LT_POS(VIsual, curwin->w_cursor))
dec_cursor();
@@ -4888,12 +4887,11 @@
decl(&pos);
}
- /* Is the pattern is zero-width?, this time, don't care about the direction
- */
+ // Is the pattern is zero-width?, this time, don't care about the direction
zero_width = is_zero_width(spats[last_idx].pat, TRUE, &curwin->w_cursor,
FORWARD);
if (zero_width == -1)
- return FAIL; /* pattern not found */
+ return FAIL; // pattern not found
/*
* The trick is to first search backwards and then search forward again,
@@ -4923,11 +4921,11 @@
p_ws = old_p_ws;
- /* First search may fail, but then start searching from the
- * beginning of the file (cursor might be on the search match)
- * except when Visual mode is active, so that extending the visual
- * selection works. */
- if (i == 1 && !result) /* not found, abort */
+ // First search may fail, but then start searching from the
+ // beginning of the file (cursor might be on the search match)
+ // except when Visual mode is active, so that extending the visual
+ // selection works.
+ if (i == 1 && !result) // not found, abort
{
curwin->w_cursor = orig_pos;
if (VIsual_active)
@@ -4938,13 +4936,13 @@
{
if (forward)
{
- /* try again from start of buffer */
+ // try again from start of buffer
CLEAR_POS(&pos);
}
else
{
- /* try again from end of buffer */
- /* searching backwards, so set pos to last line and col */
+ // try again from end of buffer
+ // searching backwards, so set pos to last line and col
pos.lnum = curwin->w_buffer->b_ml.ml_line_count;
pos.col = (colnr_T)STRLEN(
ml_get(curwin->w_buffer->b_ml.ml_line_count));
@@ -4968,7 +4966,7 @@
if (*p_sel == 'e')
{
- /* Correction for exclusive selection depends on the direction. */
+ // Correction for exclusive selection depends on the direction.
if (forward && LTOREQ_POS(VIsual, curwin->w_cursor))
inc_cursor();
else if (!forward && LTOREQ_POS(curwin->w_cursor, VIsual))
@@ -4983,8 +4981,8 @@
may_start_select('c');
setmouse();
#ifdef FEAT_CLIPBOARD
- /* Make sure the clipboard gets updated. Needed because start and
- * end are still the same, and the selection needs to be owned */
+ // Make sure the clipboard gets updated. Needed because start and
+ // end are still the same, and the selection needs to be owned
clip_star.vmode = NUL;
#endif
redraw_curbuf_later(INVERTED);
@@ -5147,20 +5145,20 @@
*/
void
find_pattern_in_path(
- char_u *ptr, /* pointer to search pattern */
- int dir UNUSED, /* direction of expansion */
- int len, /* length of search pattern */
- int whole, /* match whole words only */
- int skip_comments, /* don't match inside comments */
- int type, /* Type of search; are we looking for a type?
- a macro? */
+ char_u *ptr, // pointer to search pattern
+ int dir UNUSED, // direction of expansion
+ int len, // length of search pattern
+ int whole, // match whole words only
+ int skip_comments, // don't match inside comments
+ int type, // Type of search; are we looking for a type?
+ // a macro?
long count,
- int action, /* What to do when we find it */
- linenr_T start_lnum, /* first line to start searching */
- linenr_T end_lnum) /* last line for searching */
+ int action, // What to do when we find it
+ linenr_T start_lnum, // first line to start searching
+ linenr_T end_lnum) // last line for searching
{
- SearchedFile *files; /* Stack of included files */
- SearchedFile *bigger; /* When we need more space */
+ SearchedFile *files; // Stack of included files
+ SearchedFile *bigger; // When we need more space
int max_path_depth = 50;
long match_count = 1;
@@ -5170,7 +5168,7 @@
char_u *prev_fname = NULL;
linenr_T lnum;
int depth;
- int depth_displayed; /* For type==CHECK_PATH */
+ int depth_displayed; // For type==CHECK_PATH
int old_files;
int already_searched;
char_u *file_line;
@@ -5201,15 +5199,15 @@
return;
if (type != CHECK_PATH && type != FIND_DEFINE
- /* when CONT_SOL is set compare "ptr" with the beginning of the line
- * is faster than quote_meta/regcomp/regexec "ptr" -- Acevedo */
+ // when CONT_SOL is set compare "ptr" with the beginning of the line
+ // is faster than quote_meta/regcomp/regexec "ptr" -- Acevedo
&& !(compl_cont_status & CONT_SOL))
{
pat = alloc(len + 5);
if (pat == NULL)
goto fpip_end;
sprintf((char *)pat, whole ? "\\<%.*s\\>" : "%.*s", len, ptr);
- /* ignore case according to p_ic, p_scs and pat */
+ // ignore case according to p_ic, p_scs and pat
regmatch.rm_ic = ignorecase(pat);
regmatch.regprog = vim_regcomp(pat, p_magic ? RE_MAGIC : 0);
vim_free(pat);
@@ -5222,7 +5220,7 @@
incl_regmatch.regprog = vim_regcomp(inc_opt, p_magic ? RE_MAGIC : 0);
if (incl_regmatch.regprog == NULL)
goto fpip_end;
- incl_regmatch.rm_ic = FALSE; /* don't ignore case in incl. pat. */
+ incl_regmatch.rm_ic = FALSE; // don't ignore case in incl. pat.
}
if (type == FIND_DEFINE && (*curbuf->b_p_def != NUL || *p_def != NUL))
{
@@ -5230,7 +5228,7 @@
? p_def : curbuf->b_p_def, p_magic ? RE_MAGIC : 0);
if (def_regmatch.regprog == NULL)
goto fpip_end;
- def_regmatch.rm_ic = FALSE; /* don't ignore case in define pat. */
+ def_regmatch.rm_ic = FALSE; // don't ignore case in define pat.
}
files = lalloc_clear(max_path_depth * sizeof(SearchedFile), TRUE);
if (files == NULL)
@@ -5241,7 +5239,7 @@
lnum = start_lnum;
if (end_lnum > curbuf->b_ml.ml_line_count)
end_lnum = curbuf->b_ml.ml_line_count;
- if (lnum > end_lnum) /* do at least one line */
+ if (lnum > end_lnum) // do at least one line
lnum = end_lnum;
line = ml_get(lnum);
@@ -5254,18 +5252,18 @@
? curbuf->b_ffname : curr_fname;
if (inc_opt != NULL && strstr((char *)inc_opt, "\\zs") != NULL)
- /* Use text from '\zs' to '\ze' (or end) of 'include'. */
+ // Use text from '\zs' to '\ze' (or end) of 'include'.
new_fname = find_file_name_in_path(incl_regmatch.startp[0],
(int)(incl_regmatch.endp[0] - incl_regmatch.startp[0]),
FNAME_EXP|FNAME_INCL|FNAME_REL, 1L, p_fname);
else
- /* Use text after match with 'include'. */
+ // Use text after match with 'include'.
new_fname = file_name_in_line(incl_regmatch.endp[0], 0,
FNAME_EXP|FNAME_INCL|FNAME_REL, 1L, p_fname, NULL);
already_searched = FALSE;
if (new_fname != NULL)
{
- /* Check whether we have already searched in this file */
+ // Check whether we have already searched in this file
for (i = 0;; i++)
{
if (i == depth + 1)
@@ -5278,10 +5276,10 @@
if (type != CHECK_PATH &&
action == ACTION_SHOW_ALL && files[i].matched)
{
- msg_putchar('\n'); /* cursor below last one */
- if (!got_int) /* don't display if 'q'
- typed at "--more--"
- message */
+ msg_putchar('\n'); // cursor below last one
+ if (!got_int) // don't display if 'q'
+ // typed at "--more--"
+ // message
{
msg_home_replace_hl(new_fname);
msg_puts(_(" (includes previously listed match)"));
@@ -5299,10 +5297,10 @@
|| (new_fname == NULL && !already_searched)))
{
if (did_show)
- msg_putchar('\n'); /* cursor below last one */
+ msg_putchar('\n'); // cursor below last one
else
{
- gotocmdline(TRUE); /* cursor at status line */
+ gotocmdline(TRUE); // cursor at status line
msg_puts_title(_("--- Included files "));
if (action != ACTION_SHOW_ALL)
msg_puts_title(_("not found "));
@@ -5317,15 +5315,15 @@
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
@@ -5337,14 +5335,14 @@
if (inc_opt != NULL
&& strstr((char *)inc_opt, "\\zs") != NULL)
{
- /* pattern contains \zs, use the match */
+ // pattern contains \zs, use the match
p = incl_regmatch.startp[0];
i = (int)(incl_regmatch.endp[0]
- incl_regmatch.startp[0]);
}
else
{
- /* find the file name after the end of the match */
+ // find the file name after the end of the match
for (p = incl_regmatch.endp[0];
*p && !vim_isfilec(*p); p++)
;
@@ -5354,12 +5352,12 @@
if (i == 0)
{
- /* Nothing found, use the rest of the line. */
+ // Nothing found, use the rest of the line.
p = incl_regmatch.endp[0];
i = (int)STRLEN(p);
}
- /* Avoid checking before the start of the line, can
- * happen if \zs appears in the regexp. */
+ // Avoid checking before the start of the line, can
+ // happen if \zs appears in the regexp.
else if (p > line)
{
if (p[-1] == '"' || p[-1] == '<')
@@ -5384,12 +5382,12 @@
msg_puts(_(" NOT FOUND"));
}
}
- out_flush(); /* output each line directly */
+ out_flush(); // output each line directly
}
if (new_fname != NULL)
{
- /* Push the new file onto the file stack */
+ // Push the new file onto the file stack
if (depth + 1 == old_files)
{
bigger = ALLOC_MULT(SearchedFile, max_path_depth * 2);
@@ -5431,7 +5429,7 @@
files[depth].matched = FALSE;
if (action == ACTION_EXPAND)
{
- msg_hist_off = TRUE; /* reset in msg_trunc_attr() */
+ msg_hist_off = TRUE; // reset in msg_trunc_attr()
vim_snprintf((char*)IObuff, IOSIZE,
_("Scanning included file: %s"),
(char *)new_fname);
@@ -5478,7 +5476,7 @@
{
if (define_matched || (compl_cont_status & CONT_SOL))
{
- /* compare the first "len" chars from "ptr" */
+ // compare the first "len" chars from "ptr"
startp = skipwhite(p);
if (p_ic)
matched = !MB_STRNICMP(startp, ptr, len);
@@ -5521,14 +5519,14 @@
&& (p[1] == '*' || p[1] == '/'))
{
matched = FALSE;
- /* After "//" all text is comment */
+ // After "//" all text is comment
if (p[1] == '/')
break;
++p;
}
else if (!matched && p[0] == '*' && p[1] == '/')
{
- /* Can find match after "* /". */
+ // Can find match after "* /".
matched = TRUE;
++p;
}
@@ -5561,12 +5559,12 @@
if ((compl_cont_status & CONT_ADDING) && i == compl_length)
{
- /* IOSIZE > compl_length, so the STRNCPY works */
+ // IOSIZE > compl_length, so the STRNCPY works
STRNCPY(IObuff, aux, i);
- /* Get the next line: when "depth" < 0 from the current
- * buffer, otherwise from the included file. Jump to
- * exit_matched when past the last line. */
+ // Get the next line: when "depth" < 0 from the current
+ // buffer, otherwise from the included file. Jump to
+ // exit_matched when past the last line.
if (depth < 0)
{
if (lnum >= end_lnum)
@@ -5577,9 +5575,9 @@
LSIZE, files[depth].fp))
goto exit_matched;
- /* we read a line, set "already" to check this "line" later
- * if depth >= 0 we'll increase files[depth].lnum far
- * bellow -- Acevedo */
+ // we read a line, set "already" to check this "line" later
+ // if depth >= 0 we'll increase files[depth].lnum far
+ // bellow -- Acevedo
already = aux = p = skipwhite(line);
p = find_word_start(p);
p = find_word_end(p);
@@ -5589,7 +5587,7 @@
{
if (IObuff[i-1] != ' ')
IObuff[i++] = ' ';
- /* IObuf =~ "\(\k\|\i\).* ", thus i >= 2*/
+ // IObuf =~ "\(\k\|\i\).* ", thus i >= 2
if (p_js
&& (IObuff[i-2] == '.'
|| (vim_strchr(p_cpo, CPO_JOINSP) == NULL
@@ -5597,7 +5595,7 @@
|| IObuff[i-2] == '!'))))
IObuff[i++] = ' ';
}
- /* copy as much as possible of the new word */
+ // copy as much as possible of the new word
if (p - aux >= IOSIZE - i)
p = aux + IOSIZE - i - 1;
STRNCPY(IObuff + i, aux, p - aux);
@@ -5615,7 +5613,7 @@
curr_fname == curbuf->b_fname ? NULL : curr_fname,
dir, cont_s_ipos);
if (add_r == OK)
- /* if dir was BACKWARD then honor it just once */
+ // if dir was BACKWARD then honor it just once
dir = FORWARD;
else if (add_r == FAIL)
break;
@@ -5624,13 +5622,13 @@
{
found = TRUE;
if (!did_show)
- gotocmdline(TRUE); /* cursor at status line */
+ gotocmdline(TRUE); // cursor at status line
if (curr_fname != prev_fname)
{
if (did_show)
- msg_putchar('\n'); /* cursor below last one */
- if (!got_int) /* don't display if 'q' typed
- at "--more--" message */
+ msg_putchar('\n'); // cursor below last one
+ if (!got_int) // don't display if 'q' typed
+ // at "--more--" message
msg_home_replace_hl(curr_fname);
prev_fname = curr_fname;
}
@@ -5641,8 +5639,8 @@
(depth == -1) ? &lnum : &files[depth].lnum,
match_count++);
- /* Set matched flag for this file and all the ones that
- * include it */
+ // Set matched flag for this file and all the ones that
+ // include it
for (i = 0; i <= depth; ++i)
files[i].matched = TRUE;
}
@@ -5668,7 +5666,7 @@
need_mouse_correct = TRUE;
#endif
#if defined(FEAT_QUICKFIX)
- /* ":psearch" uses the preview window */
+ // ":psearch" uses the preview window
if (g_do_tagpreview != 0)
{
curwin_save = curwin;
@@ -5683,14 +5681,14 @@
}
if (depth == -1)
{
- /* match in current file */
+ // match in current file
#if defined(FEAT_QUICKFIX)
if (g_do_tagpreview != 0)
{
if (!GETFILE_SUCCESS(getfile(
curwin_save->w_buffer->b_fnum, NULL,
NULL, TRUE, lnum, FALSE)))
- break; /* failed to jump to file */
+ break; // failed to jump to file
}
else
#endif
@@ -5703,9 +5701,9 @@
if (!GETFILE_SUCCESS(getfile(
0, files[depth].name, NULL, TRUE,
files[depth].lnum, FALSE)))
- break; /* failed to jump to file */
- /* autocommands may have changed the lnum, we don't
- * want that here */
+ break; // failed to jump to file
+ // autocommands may have changed the lnum, we don't
+ // want that here
curwin->w_cursor.lnum = files[depth].lnum;
}
}
@@ -5719,7 +5717,7 @@
if (g_do_tagpreview != 0
&& curwin != curwin_save && win_valid(curwin_save))
{
- /* Return cursor to where we were */
+ // Return cursor to where we were
validate_cursor();
redraw_later(VALID);
win_enter(curwin_save, TRUE);
@@ -5734,8 +5732,8 @@
}
exit_matched:
matched = FALSE;
- /* look for other matches in the rest of the line if we
- * are not at the end of it already */
+ // look for other matches in the rest of the line if we
+ // are not at the end of it already
if (def_regmatch.regprog == NULL
&& action == ACTION_EXPAND
&& !(compl_cont_status & CONT_SOL)
@@ -5767,10 +5765,10 @@
if (depth < depth_displayed)
depth_displayed = depth;
}
- if (depth >= 0) /* we could read the line */
+ if (depth >= 0) // we could read the line
{
files[depth].lnum++;
- /* Remove any CR and LF from the line. */
+ // Remove any CR and LF from the line.
i = (int)STRLEN(line);
if (i > 0 && line[i - 1] == '\n')
line[--i] = NUL;
@@ -5785,9 +5783,9 @@
}
already = NULL;
}
- /* End of big for (;;) loop. */
+ // End of big for (;;) loop.
- /* Close any files that are still open. */
+ // Close any files that are still open.
for (i = 0; i <= depth; i++)
{
fclose(files[i].fp);
@@ -5839,17 +5837,17 @@
char_u *p;
if (did_show)
- msg_putchar('\n'); /* cursor below last one */
+ msg_putchar('\n'); // cursor below last one
else if (!msg_silent)
- gotocmdline(TRUE); /* cursor at status line */
- if (got_int) /* 'q' typed at "--more--" message */
+ gotocmdline(TRUE); // cursor at status line
+ if (got_int) // 'q' typed at "--more--" message
return;
for (;;)
{
p = line + STRLEN(line) - 1;
if (fp != NULL)
{
- /* We used fgets(), so get rid of newline at end */
+ // We used fgets(), so get rid of newline at end
if (p >= line && *p == '\n')
--p;
if (p >= line && *p == '\r')
@@ -5858,23 +5856,23 @@
}
if (action == ACTION_SHOW_ALL)
{
- sprintf((char *)IObuff, "%3ld: ", count); /* show match nr */
+ sprintf((char *)IObuff, "%3ld: ", count); // show match nr
msg_puts((char *)IObuff);
- sprintf((char *)IObuff, "%4ld", *lnum); /* show line nr */
- /* Highlight line numbers */
+ sprintf((char *)IObuff, "%4ld", *lnum); // show line nr
+ // Highlight line numbers
msg_puts_attr((char *)IObuff, HL_ATTR(HLF_N));
msg_puts(" ");
}
msg_prt_line(line, FALSE);
- out_flush(); /* show one line at a time */
+ out_flush(); // show one line at a time
- /* Definition continues until line that doesn't end with '\' */
+ // Definition continues until line that doesn't end with '\'
if (got_int || type != FIND_DEFINE || p < line || *p != '\\')
break;
if (fp != NULL)
{
- if (vim_fgets(line, LSIZE, fp)) /* end of file */
+ if (vim_fgets(line, LSIZE, fp)) // end of file
break;
++*lnum;
}