vim-patch:8.1.2379: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
217e1b8359
This commit is contained in:
Dundar Göc 2021-10-06 10:46:45 +02:00
parent 3b3e2244db
commit 0c7d7fb45d
6 changed files with 310 additions and 313 deletions

View File

@ -361,8 +361,8 @@ static int linelen(int *has_tab)
return len;
}
/* Buffer for two lines used during sorting. They are allocated to
* contain the longest line being sorted. */
// Buffer for two lines used during sorting. They are allocated to
// contain the longest line being sorted.
static char_u *sortbuf1;
static char_u *sortbuf2;
@ -404,9 +404,9 @@ static int sort_compare(const void *s1, const void *s2)
sorti_T l2 = *(sorti_T *)s2;
int result = 0;
/* If the user interrupts, there's no way to stop qsort() immediately, but
* if we return 0 every time, qsort will assume it's done sorting and
* exit. */
// If the user interrupts, there's no way to stop qsort() immediately, but
// if we return 0 every time, qsort will assume it's done sorting and
// exit.
if (sort_abort) {
return 0;
}
@ -1733,8 +1733,8 @@ int rename_buffer(char_u *new_fname)
*/
void ex_file(exarg_T *eap)
{
/* ":0file" removes the file name. Check for illegal uses ":3file",
* "0file name", etc. */
// ":0file" removes the file name. Check for illegal uses ":3file",
// "0file name", etc.
if (eap->addr_count > 0
&& (*eap->arg != NUL
|| eap->line2 > 0
@ -1888,11 +1888,11 @@ int do_write(exarg_T *eap)
retval = FAIL;
goto theend;
}
/* Exchange the file names for the current and the alternate
* buffer. This makes it look like we are now editing the buffer
* under the new name. Must be done before buf_write(), because
* if there is no file name and 'cpo' contains 'F', it will set
* the file name. */
// Exchange the file names for the current and the alternate
// buffer. This makes it look like we are now editing the buffer
// under the new name. Must be done before buf_write(), because
// if there is no file name and 'cpo' contains 'F', it will set
// the file name.
fname = alt_buf->b_fname;
alt_buf->b_fname = curbuf->b_fname;
curbuf->b_fname = fname;
@ -1923,8 +1923,8 @@ int do_write(exarg_T *eap)
do_modelines(0);
}
/* Autocommands may have changed buffer names, esp. when
* 'autochdir' is set. */
// Autocommands may have changed buffer names, esp. when
// 'autochdir' is set.
fname = curbuf->b_sfname;
}
@ -2003,11 +2003,11 @@ int check_overwrite(exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int
char_u *p;
char_u *swapname;
/* We only try the first entry in 'directory', without checking if
* it's writable. If the "." directory is not writable the write
* will probably fail anyway.
* Use 'shortname' of the current buffer, since there is no buffer
* for the written file. */
// We only try the first entry in 'directory', without checking if
// it's writable. If the "." directory is not writable the write
// will probably fail anyway.
// Use 'shortname' of the current buffer, since there is no buffer
// for the written file.
if (*p_dir == NUL) {
dir = xmalloc(5);
STRCPY(dir, ".");
@ -2466,8 +2466,8 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
}
}
/* May jump to last used line number for a loaded buffer or when asked
* for explicitly */
// May jump to last used line number for a loaded buffer or when asked
// for explicitly
if ((oldbuf && newlnum == ECMD_LASTL) || newlnum == ECMD_LAST) {
pos = buflist_findfpos(buf);
newlnum = pos->lnum;
@ -2577,10 +2577,10 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
}
}
/* May get the window options from the last time this buffer
* was in this window (or another window). If not used
* before, reset the local window options to the global
* values. Also restores old folding stuff. */
// May get the window options from the last time this buffer
// was in this window (or another window). If not used
// before, reset the local window options to the global
// values. Also restores old folding stuff.
get_winopts(curbuf);
did_get_winopts = true;
}
@ -2621,10 +2621,10 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
goto theend;
}
/* Since we are starting to edit a file, consider the filetype to be
* unset. Helps for when an autocommand changes files and expects syntax
* highlighting to work in the other file. */
did_filetype = FALSE;
// Since we are starting to edit a file, consider the filetype to be
// unset. Helps for when an autocommand changes files and expects syntax
// highlighting to work in the other file.
did_filetype = false;
/*
* other_file oldbuf
@ -2828,8 +2828,8 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
&& !auto_buf) {
int msg_scroll_save = msg_scroll;
/* Obey the 'O' flag in 'cpoptions': overwrite any previous file
* message. */
// Obey the 'O' flag in 'cpoptions': overwrite any previous file
// message.
if (shortmess(SHM_OVERALL) && !exiting && p_verbose == 0) {
msg_scroll = FALSE;
}
@ -2953,8 +2953,8 @@ void ex_append(exarg_T *eap)
}
}
if (eap->getline == NULL) {
/* No getline() function, use the lines that follow. This ends
* when there is no more. */
// No getline() function, use the lines that follow. This ends
// when there is no more.
if (eap->nextcmd == NULL || *eap->nextcmd == NUL) {
break;
}
@ -3750,8 +3750,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
sub_firstline = vim_strsave(ml_get(sub_firstlnum));
}
/* Save the line number of the last change for the final
* cursor position (just like Vi). */
// Save the line number of the last change for the final
// cursor position (just like Vi).
curwin->w_cursor.lnum = lnum;
do_again = FALSE;
@ -3778,8 +3778,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
goto skip;
}
/* Normally we continue searching for a match just after the
* previous match. */
// Normally we continue searching for a match just after the
// previous match.
matchcol = regmatch.endpos[0].col;
prev_matchcol = matchcol;
@ -3818,8 +3818,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
do_check_cursorbind();
}
/* When 'cpoptions' contains "u" don't sync undo when
* asking for confirmation. */
// When 'cpoptions' contains "u" don't sync undo when
// asking for confirmation.
if (vim_strchr(p_cpo, CPO_UNDO) != NULL) {
++no_u_sync;
}
@ -3970,11 +3970,11 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
}
if (typed == 'n') {
/* For a multi-line match, put matchcol at the NUL at
* the end of the line and set nmatch to one, so that
* we continue looking for a match on the next line.
* Avoids that ":%s/\nB\@=//gc" and ":%s/\n/,\r/gc"
* get stuck when pressing 'n'. */
// For a multi-line match, put matchcol at the NUL at
// the end of the line and set nmatch to one, so that
// we continue looking for a match on the next line.
// Avoids that ":%s/\nB\@=//gc" and ":%s/\n/,\r/gc"
// get stuck when pressing 'n'.
if (nmatch > 1) {
matchcol = (colnr_T)STRLEN(sub_firstline);
skip_match = true;
@ -3986,8 +3986,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
}
}
/* Move the cursor to the start of the match, so that we can
* use "\=col("."). */
// Move the cursor to the start of the match, so that we can
// use "\=col(".").
curwin->w_cursor.col = regmatch.startpos[0].col;
// When the match included the "$" of the last line it may
@ -4178,11 +4178,11 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
// strings, e.g. :s/$/pat/g or :s/[a-z]* /(&)/g.
// But ":s/\n/#/" is OK.
skip:
/* We already know that we did the last subst when we are at
* the end of the line, except that a pattern like
* "bar\|\nfoo" may match at the NUL. "lnum" can be below
* "line2" when there is a \zs in the pattern after a line
* break. */
// We already know that we did the last subst when we are at
// the end of the line, except that a pattern like
// "bar\|\nfoo" may match at the NUL. "lnum" can be below
// "line2" when there is a \zs in the pattern after a line
// break.
lastone = (skip_match
|| got_int
|| got_quit
@ -4249,8 +4249,8 @@ skip:
nmatch_tl = 0;
}
/* When asking, undo is saved each time, must also set
* changed flag each time. */
// When asking, undo is saved each time, must also set
// changed flag each time.
if (subflags.do_ask) {
changed_bytes(lnum, 0);
} else {
@ -4278,9 +4278,9 @@ skip:
* 5. break if there isn't another match in this line
*/
if (nmatch <= 0) {
/* If the match found didn't start where we were
* searching, do the next search in the line where we
* found the match. */
// If the match found didn't start where we were
// searching, do the next search in the line where we
// found the match.
if (nmatch == -1) {
lnum -= regmatch.startpos[0].lnum;
}
@ -4329,9 +4329,9 @@ skip:
curbuf->deleted_bytes2 = 0;
if (first_line != 0) {
/* Need to subtract the number of added lines from "last_line" to get
* the line number before the change (same as adding the number of
* deleted lines). */
// Need to subtract the number of added lines from "last_line" to get
// the line number before the change (same as adding the number of
// deleted lines).
i = curbuf->b_ml.ml_line_count - old_line_count;
changed_lines(first_line, 0, last_line - i, i, false);
@ -4842,9 +4842,9 @@ void ex_help(exarg_T *eap)
}
fclose(helpfd);
/* Split off help window; put it at far top if no position
* specified, the current window is vertically split and
* narrow. */
// Split off help window; put it at far top if no position
// specified, the current window is vertically split and
// narrow.
n = WSP_HELP;
if (cmdmod.split == 0 && curwin->w_width != Columns
&& curwin->w_width < 80) {
@ -4884,9 +4884,9 @@ void ex_help(exarg_T *eap)
do_tag(tag, DT_HELP, 1, FALSE, TRUE);
/* Delete the empty buffer if we're not using it. Careful: autocommands
* may have jumped to another window, check that the buffer is not in a
* window. */
// Delete the empty buffer if we're not using it. Careful: autocommands
// may have jumped to another window, check that the buffer is not in a
// window.
if (empty_fnum != 0 && curbuf->b_fnum != empty_fnum) {
buf = buflist_findnr(empty_fnum);
if (buf != NULL && buf->b_nwindows == 0) {
@ -5057,11 +5057,11 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, bool
}
if (i < 0) { // no match in table
/* Replace "\S" with "/\\S", etc. Otherwise every tag is matched.
* Also replace "\%^" and "\%(", they match every tag too.
* Also "\zs", "\z1", etc.
* Also "\@<", "\@=", "\@<=", etc.
* And also "\_$" and "\_^". */
// Replace "\S" with "/\\S", etc. Otherwise every tag is matched.
// Also replace "\%^" and "\%(", they match every tag too.
// Also "\zs", "\z1", etc.
// Also "\@<", "\@=", "\@<=", etc.
// And also "\_$" and "\_^".
if (arg[0] == '\\'
&& ((arg[1] != NUL && arg[2] == NUL)
|| (vim_strchr((char_u *)"%_z@", arg[1]) != NULL
@ -5158,8 +5158,8 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, bool
*d++ = '\\';
}
/* "CTRL-\_" -> "CTRL-\\_" to avoid the special meaning of "\_" in
* "CTRL-\_CTRL-N" */
// "CTRL-\_" -> "CTRL-\\_" to avoid the special meaning of "\_" in
// "CTRL-\_CTRL-N"
if (STRNICMP(s, "CTRL-\\_", 7) == 0) {
STRCPY(d, "CTRL-\\\\");
d += 7;
@ -5213,8 +5213,8 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, bool
}
if (find_tags(IObuff, num_matches, matches, flags, MAXCOL, NULL) == OK
&& *num_matches > 0) {
/* Sort the matches found on the heuristic number that is after the
* tag name. */
// Sort the matches found on the heuristic number that is after the
// tag name.
qsort((void *)*matches, (size_t)*num_matches,
sizeof(char_u *), help_compare);
// Delete more than TAG_MANY to reduce the size of the listing.

View File

@ -197,8 +197,8 @@ void do_exmode(void)
exmode_active = true;
State = NORMAL;
/* When using ":global /pat/ visual" and then "Q" we return to continue
* the :global command. */
// When using ":global /pat/ visual" and then "Q" we return to continue
// the :global command.
if (global_busy) {
return;
}
@ -231,8 +231,8 @@ void do_exmode(void)
EMSG(_(e_emptybuf));
} else {
if (ex_pressedreturn) {
/* go up one line, to overwrite the ":<CR>" line, so the
* output doesn't contain empty lines. */
// go up one line, to overwrite the ":<CR>" line, so the
// output doesn't contain empty lines.
msg_row = prev_msg_row;
if (prev_msg_row == Rows - 1) {
msg_row--;
@ -374,8 +374,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
++ex_nesting_level;
}
/* Get the function or script name and the address where the next breakpoint
* line and the debug tick for a function or script are stored. */
// Get the function or script name and the address where the next breakpoint
// line and the debug tick for a function or script are stored.
if (getline_is_func) {
fname = func_name(real_cookie);
breakpoint = func_breakpoint(real_cookie);
@ -500,11 +500,11 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
}
if (cstack.cs_looplevel > 0) {
/* Inside a while/for loop we need to store the lines and use them
* again. Pass a different "fgetline" function to do_one_cmd()
* below, so that it stores lines in or reads them from
* "lines_ga". Makes it possible to define a function inside a
* while/for loop. */
// Inside a while/for loop we need to store the lines and use them
// again. Pass a different "fgetline" function to do_one_cmd()
// below, so that it stores lines in or reads them from
// "lines_ga". Makes it possible to define a function inside a
// while/for loop.
cmd_getline = get_loop_line;
cmd_cookie = (void *)&cmd_loop_cookie;
cmd_loop_cookie.lines_gap = &lines_ga;
@ -612,8 +612,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
}
if (cmd_cookie == (void *)&cmd_loop_cookie) {
/* Use "current_line" from "cmd_loop_cookie", it may have been
* incremented when defining a function. */
// Use "current_line" from "cmd_loop_cookie", it may have been
// incremented when defining a function.
current_line = cmd_loop_cookie.current_line;
}
@ -671,8 +671,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
cstack.cs_lflags |= CSL_HAD_LOOP;
line_breakcheck(); // check if CTRL-C typed
/* Check for the next breakpoint at or after the ":while"
* or ":for". */
// Check for the next breakpoint at or after the ":while"
// or ":for".
if (breakpoint != NULL) {
*breakpoint = dbg_find_breakpoint(getline_equal(fgetline, cookie, getsourceline),
fname,
@ -724,8 +724,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
cstack.cs_flags[cstack.cs_idx] |= CSF_ACTIVE | CSF_FINALLY;
}
/* Update global "trylevel" for recursive calls to do_cmdline() from
* within this loop. */
// Update global "trylevel" for recursive calls to do_cmdline() from
// within this loop.
trylevel = initial_trylevel + cstack.cs_trylevel;
// If the outermost try conditional (across function calls and sourced
@ -806,9 +806,9 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
trylevel = initial_trylevel;
}
/* If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
* lack was reported above and the error message is to be converted to an
* exception, do this now after rewinding the cstack. */
// If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
// lack was reported above and the error message is to be converted to an
// exception, do this now after rewinding the cstack.
do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line)
? (char_u *)"endfunction" : (char_u *)NULL);
@ -1014,9 +1014,9 @@ int getline_equal(LineGetter fgetline, void *cookie, LineGetter func)
LineGetter gp;
struct loop_cookie *cp;
/* When "fgetline" is "get_loop_line()" use the "cookie" to find the
* function that's originally used to obtain the lines. This may be
* nested several levels. */
// When "fgetline" is "get_loop_line()" use the "cookie" to find the
// function that's originally used to obtain the lines. This may be
// nested several levels.
gp = fgetline;
cp = (struct loop_cookie *)cookie;
while (gp == get_loop_line) {
@ -1035,9 +1035,9 @@ void *getline_cookie(LineGetter fgetline, void *cookie)
LineGetter gp;
struct loop_cookie *cp;
/* When "fgetline" is "get_loop_line()" use the "cookie" to find the
* cookie that's originally used to obtain the lines. This may be nested
* several levels. */
// When "fgetline" is "get_loop_line()" use the "cookie" to find the
// cookie that's originally used to obtain the lines. This may be nested
// several levels.
gp = fgetline;
cp = (struct loop_cookie *)cookie;
while (gp == get_loop_line) {
@ -2625,9 +2625,9 @@ static char_u *find_command(exarg_T *eap, int *full)
}
len = (int)(p - eap->cmd);
if (*eap->cmd == 'd' && (p[-1] == 'l' || p[-1] == 'p')) {
/* Check for ":dl", ":dell", etc. to ":deletel": that's
* :delete with the 'l' flag. Same for 'p'. */
for (i = 0; i < len; ++i) {
// Check for ":dl", ":dell", etc. to ":deletel": that's
// :delete with the 'l' flag. Same for 'p'.
for (i = 0; i < len; i++) {
if (eap->cmd[i] != ((char_u *)"delete")[i]) {
break;
}
@ -4435,8 +4435,8 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
continue;
}
/* Wildcards won't be expanded below, the replacement is taken
* literally. But do expand "~/file", "~user/file" and "$HOME/file". */
// Wildcards won't be expanded below, the replacement is taken
// literally. But do expand "~/file", "~user/file" and "$HOME/file".
if (vim_strchr(repl, '$') != NULL || vim_strchr(repl, '~') != NULL) {
char_u *l = repl;
@ -4463,8 +4463,8 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
&& !(eap->argt & EX_NOSPC)) {
char_u *l;
#ifdef BACKSLASH_IN_FILENAME
/* Don't escape a backslash here, because rem_backslash() doesn't
* remove it later. */
// Don't escape a backslash here, because rem_backslash() doesn't
// remove it later.
static char_u *nobslash = (char_u *)" \t\"|";
# define ESCAPE_CHARS nobslash
#else
@ -7205,8 +7205,8 @@ void ex_splitview(exarg_T *eap)
}
} else if (win_split(eap->addr_count > 0 ? (int)eap->line2 : 0,
*eap->cmd == 'v' ? WSP_VERT : 0) != FAIL) {
/* Reset 'scrollbind' when editing another file, but keep it when
* doing ":split" without arguments. */
// Reset 'scrollbind' when editing another file, but keep it when
// doing ":split" without arguments.
if (*eap->arg != NUL
) {
RESET_BINDING(curwin);
@ -7402,8 +7402,8 @@ static void ex_find(exarg_T *eap)
fname = find_file_in_path(eap->arg, STRLEN(eap->arg),
FNAME_MESS, TRUE, curbuf->b_ffname);
if (eap->addr_count > 0) {
/* Repeat finding the file "count" times. This matters when it
* appears several times in the path. */
// Repeat finding the file "count" times. This matters when it
// appears several times in the path.
count = eap->line2;
while (fname != NULL && --count > 0) {
xfree(fname);
@ -7509,8 +7509,8 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
if (!need_hide || buf_hide(curbuf)) {
cleanup_T cs;
/* Reset the error/interrupt/exception state here so that
* aborting() returns FALSE when closing a window. */
// Reset the error/interrupt/exception state here so that
// aborting() returns FALSE when closing a window.
enter_cleanup(&cs);
win_close(curwin, !need_hide && !buf_hide(curbuf));
@ -7675,8 +7675,8 @@ static void ex_read(exarg_T *eap)
}
} else {
if (empty && exmode_active) {
/* Delete the empty line that remains. Historically ex does
* this but vi doesn't. */
// Delete the empty line that remains. Historically ex does
// this but vi doesn't.
if (eap->line2 == 0) {
lnum = curbuf->b_ml.ml_line_count;
} else {
@ -8298,8 +8298,8 @@ static void ex_redir(exarg_T *eap)
}
}
/* Make sure redirection is not off. Can happen for cmdline completion
* that indirectly invokes a command to catch its output. */
// Make sure redirection is not off. Can happen for cmdline completion
// that indirectly invokes a command to catch its output.
if (redir_fd != NULL
|| redir_reg || redir_vname) {
redir_off = false;

View File

@ -135,8 +135,8 @@ int should_abort(int retcode)
*/
int aborted_in_try(void)
{
/* This function is only called after an error. In this case, "force_abort"
* determines whether searching for finally clauses is necessary. */
// This function is only called after an error. In this case, "force_abort"
// determines whether searching for finally clauses is necessary.
return force_abort;
}
@ -321,8 +321,8 @@ void do_errthrow(cstack_T *cstack, char_u *cmdname)
force_abort = TRUE;
}
/* If no exception is to be thrown or the conversion should be done after
* returning to a previous invocation of do_one_cmd(), do nothing. */
// If no exception is to be thrown or the conversion should be done after
// returning to a previous invocation of do_one_cmd(), do nothing.
if (msg_list == NULL || *msg_list == NULL) {
return;
}
@ -471,8 +471,8 @@ static int throw_exception(void *value, except_type_T type, char_u *cmdname)
excp = xmalloc(sizeof(except_T));
if (type == ET_ERROR) {
/* Store the original message and prefix the exception value with
* "Vim:" or, if a command name is given, "Vim(cmdname):". */
// Store the original message and prefix the exception value with
// "Vim:" or, if a command name is given, "Vim(cmdname):".
excp->messages = (struct msglist *)value;
}
@ -940,11 +940,11 @@ void ex_else(exarg_T *eap)
if (eap->cmdidx == CMD_elseif) {
bool error;
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
/* When throwing error exceptions, we want to throw always the first
* of several errors in a row. This is what actually happens when
* a conditional error was detected above and there is another failure
* when parsing the expression. Since the skip flag is set in this
* case, the parsing error will be ignored by emsg(). */
// When throwing error exceptions, we want to throw always the first
// of several errors in a row. This is what actually happens when
// a conditional error was detected above and there is another failure
// when parsing the expression. Since the skip flag is set in this
// case, the parsing error will be ignored by emsg().
if (!skip && !error) {
if (result) {
@ -1000,8 +1000,8 @@ void ex_while(exarg_T *eap)
* ":for var in list-expr"
*/
if ((cstack->cs_lflags & CSL_HAD_LOOP) != 0) {
/* Jumping here from a ":continue" or ":endfor": use the
* previously evaluated list. */
// Jumping here from a ":continue" or ":endfor": use the
// previously evaluated list.
fi = cstack->cs_forinfo[cstack->cs_idx];
error = FALSE;
} else {
@ -1033,10 +1033,10 @@ void ex_while(exarg_T *eap)
cstack->cs_lflags ^= CSL_HAD_LOOP;
} else {
cstack->cs_lflags &= ~CSL_HAD_LOOP;
/* If the ":while" evaluates to FALSE or ":for" is past the end of
* the list, show the debug prompt at the ":endwhile"/":endfor" as
* if there was a ":break" in a ":while"/":for" evaluating to
* TRUE. */
// If the ":while" evaluates to FALSE or ":for" is past the end of
// the list, show the debug prompt at the ":endwhile"/":endfor" as
// if there was a ":break" in a ":while"/":for" evaluating to
// TRUE.
if (!skip && !error) {
cstack->cs_flags[cstack->cs_idx] |= CSF_TRUE;
}
@ -1125,8 +1125,8 @@ void ex_endwhile(exarg_T *eap)
} else {
fl = cstack->cs_flags[cstack->cs_idx];
if (!(fl & csf)) {
/* If we are in a ":while" or ":for" but used the wrong endloop
* command, do not rewind to the next enclosing ":for"/":while". */
// If we are in a ":while" or ":for" but used the wrong endloop
// command, do not rewind to the next enclosing ":for"/":while".
if (fl & CSF_WHILE) {
eap->errmsg = (char_u *)_("E732: Using :endfor with :while");
} else if (fl & CSF_FOR) {
@ -1143,8 +1143,8 @@ void ex_endwhile(exarg_T *eap)
for (idx = cstack->cs_idx; idx > 0; --idx) {
fl = cstack->cs_flags[idx];
if ((fl & CSF_TRY) && !(fl & CSF_FINALLY)) {
/* Give up at a try conditional not in its finally clause.
* Ignore the ":endwhile"/":endfor". */
// Give up at a try conditional not in its finally clause.
// Ignore the ":endwhile"/":endfor".
eap->errmsg = err;
return;
}
@ -1258,9 +1258,9 @@ void do_throw(cstack_T *cstack)
if (cstack->cs_flags[idx] & CSF_ACTIVE) {
cstack->cs_flags[idx] |= CSF_THROWN;
} else {
/* THROWN may have already been set for a catchable exception
* that has been discarded. Ensure it is reset for the new
* exception. */
// THROWN may have already been set for a catchable exception
// that has been discarded. Ensure it is reset for the new
// exception.
cstack->cs_flags[idx] &= ~CSF_THROWN;
}
}
@ -1288,9 +1288,9 @@ void ex_try(exarg_T *eap)
skip = CHECK_SKIP;
if (!skip) {
/* Set ACTIVE and TRUE. TRUE means that the corresponding ":catch"
* commands should check for a match if an exception is thrown and
* that the finally clause needs to be executed. */
// Set ACTIVE and TRUE. TRUE means that the corresponding ":catch"
// commands should check for a match if an exception is thrown and
// that the finally clause needs to be executed.
cstack->cs_flags[cstack->cs_idx] |= CSF_ACTIVE | CSF_TRUE;
/*
@ -1343,8 +1343,8 @@ void ex_catch(exarg_T *eap)
give_up = TRUE;
} else {
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) {
/* Report what's missing if the matching ":try" is not in its
* finally clause. */
// Report what's missing if the matching ":try" is not in its
// finally clause.
eap->errmsg = get_end_emsg(cstack);
skip = TRUE;
}
@ -1497,9 +1497,9 @@ void ex_finally(exarg_T *eap)
break;
}
}
/* Make this error pending, so that the commands in the following
* finally clause can be executed. This overrules also a pending
* ":continue", ":break", ":return", or ":finish". */
// Make this error pending, so that the commands in the following
// finally clause can be executed. This overrules also a pending
// ":continue", ":break", ":return", or ":finish".
pending = CSTP_ERROR;
} else {
idx = cstack->cs_idx;
@ -1524,14 +1524,14 @@ void ex_finally(exarg_T *eap)
skip = !(cstack->cs_flags[cstack->cs_idx] & CSF_TRUE);
if (!skip) {
/* When debugging or a breakpoint was encountered, display the
* debug prompt (if not already done). The user then knows that the
* finally clause is executed. */
// When debugging or a breakpoint was encountered, display the
// debug prompt (if not already done). The user then knows that the
// finally clause is executed.
if (dbg_check_skipped(eap)) {
/* Handle a ">quit" debug command as if an interrupt had
* occurred before the ":finally". That is, discard the
* original exception and replace it by an interrupt
* exception. */
// Handle a ">quit" debug command as if an interrupt had
// occurred before the ":finally". That is, discard the
// original exception and replace it by an interrupt
// exception.
(void)do_intthrow(cstack);
}
@ -1732,13 +1732,13 @@ void ex_endtry(exarg_T *eap)
case CSTP_NONE:
break;
/* Reactivate a pending ":continue", ":break", ":return",
* ":finish" from the try block or a catch clause of this try
* conditional. This is skipped, if there was an error in an
* (unskipped) conditional command or an interrupt afterwards
* or if the finally clause is present and executed a new error,
* interrupt, throw, ":continue", ":break", ":return", or
* ":finish". */
// Reactivate a pending ":continue", ":break", ":return",
// ":finish" from the try block or a catch clause of this try
// conditional. This is skipped, if there was an error in an
// (unskipped) conditional command or an interrupt afterwards
// or if the finally clause is present and executed a new error,
// interrupt, throw, ":continue", ":break", ":return", or
// ":finish".
case CSTP_CONTINUE:
ex_continue(eap);
break;
@ -1866,10 +1866,10 @@ void leave_cleanup(cleanup_T *csp)
return;
}
/* If there was an aborting error, an interrupt, or an uncaught exception
* after the corresponding call to enter_cleanup(), discard what has been
* made pending by it. Report this to the user if required by the
* 'verbose' option or when debugging. */
// If there was an aborting error, an interrupt, or an uncaught exception
// after the corresponding call to enter_cleanup(), discard what has been
// made pending by it. Report this to the user if required by the
// 'verbose' option or when debugging.
if (aborting() || need_rethrow) {
if (pending & CSTP_THROW) {
// Cancel the pending exception (includes report).
@ -1878,8 +1878,8 @@ void leave_cleanup(cleanup_T *csp)
report_discard_pending(pending, NULL);
}
/* If an error was about to be converted to an exception when
* enter_cleanup() was called, free the message list. */
// If an error was about to be converted to an exception when
// enter_cleanup() was called, free the message list.
if (msg_list != NULL) {
free_global_msglist();
}
@ -1999,10 +1999,10 @@ int cleanup_conditionals(cstack_T *cstack, int searched_cond, int inclusive)
&& (cstack->cs_flags[idx] & CSF_CAUGHT)) {
finish_exception((except_T *)cstack->cs_exception[idx]);
}
/* Stop at this try conditional - except the try block never
* got active (because of an inactive surrounding conditional
* or when the ":try" appeared after an error or interrupt or
* throw). */
// Stop at this try conditional - except the try block never
// got active (because of an inactive surrounding conditional
// or when the ":try" appeared after an error or interrupt or
// throw).
if (cstack->cs_flags[idx] & CSF_TRUE) {
if (searched_cond == 0 && !inclusive) {
break;
@ -2012,10 +2012,10 @@ int cleanup_conditionals(cstack_T *cstack, int searched_cond, int inclusive)
}
}
/* Stop on the searched conditional type (even when the surrounding
* conditional is not active or something has been made pending).
* If "inclusive" is TRUE and "searched_cond" is CSF_TRY|CSF_SILENT,
* check first whether "emsg_silent" needs to be restored. */
// Stop on the searched conditional type (even when the surrounding
// conditional is not active or something has been made pending).
// If "inclusive" is TRUE and "searched_cond" is CSF_TRY|CSF_SILENT,
// check first whether "emsg_silent" needs to be restored.
if (cstack->cs_flags[idx] & searched_cond) {
if (!inclusive) {
break;

View File

@ -2637,8 +2637,8 @@ static void realloc_cmdbuff(int len)
&& ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) {
int i = (int)(ccline.xpc->xp_pattern - p);
/* If xp_pattern points inside the old cmdbuff it needs to be adjusted
* to point into the newly allocated memory. */
// If xp_pattern points inside the old cmdbuff it needs to be adjusted
// to point into the newly allocated memory.
if (i >= 0 && i <= ccline.cmdlen) {
ccline.xpc->xp_pattern = ccline.cmdbuff + i;
}
@ -3457,8 +3457,8 @@ static bool cmdline_paste(int regname, bool literally, bool remcr)
return FAIL;
}
/* When 'incsearch' is set and CTRL-R CTRL-W used: skip the duplicate
* part of the word. */
// When 'incsearch' is set and CTRL-R CTRL-W used: skip the duplicate
// part of the word.
p = arg;
if (p_is && regname == Ctrl_W) {
char_u *w;
@ -5976,8 +5976,8 @@ int set_cmdline_pos(int pos)
return 1;
}
/* The position is not set directly but after CTRL-\ e or CTRL-R = has
* changed the command line. */
// The position is not set directly but after CTRL-\ e or CTRL-R = has
// changed the command line.
if (pos < 0) {
new_cmdpos = 0;
} else {
@ -6471,8 +6471,8 @@ static int open_cmdwin(void)
exmode_active = save_exmode;
/* Safety check: The old window or buffer was deleted: It's a bug when
* this happens! */
// Safety check: The old window or buffer was deleted: It's a bug when
// this happens!
if (!win_valid(old_curwin) || !bufref_valid(&old_curbuf)) {
cmdwin_result = Ctrl_C;
EMSG(_("E199: Active window or buffer deleted"));
@ -6498,8 +6498,8 @@ static int open_cmdwin(void)
stuffcharReadbuff(CAR);
}
} else if (cmdwin_result == Ctrl_C) {
/* :q or :close, don't execute any command
* and don't modify the cmd window. */
// :q or :close, don't execute any command
// and don't modify the cmd window.
ccline.cmdbuff = NULL;
} else {
ccline.cmdbuff = vim_strsave(get_cursor_line_ptr());

View File

@ -269,10 +269,10 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
}
}
/* Remember the initial values of curbuf, curbuf->b_ffname and
* curbuf->b_fname to detect whether they are altered as a result of
* executing nasty autocommands. Also check if "fname" and "sfname"
* point to one of these values. */
// Remember the initial values of curbuf, curbuf->b_ffname and
// curbuf->b_fname to detect whether they are altered as a result of
// executing nasty autocommands. Also check if "fname" and "sfname"
// point to one of these values.
old_curbuf = curbuf;
old_b_ffname = curbuf->b_ffname;
old_b_fname = curbuf->b_fname;
@ -429,8 +429,8 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
curbuf->b_orig_mode = 0;
}
/* Reset the "new file" flag. It will be set again below when the
* file doesn't exist. */
// Reset the "new file" flag. It will be set again below when the
// file doesn't exist.
curbuf->b_flags &= ~(BF_NEW | BF_NEW_W);
}
@ -514,8 +514,8 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
}
if (set_options) {
/* Don't change 'eol' if reading from buffer as it will already be
* correctly set when reading stdin. */
// Don't change 'eol' if reading from buffer as it will already be
// correctly set when reading stdin.
if (!read_buffer) {
curbuf->b_p_eol = TRUE;
curbuf->b_start_eol = TRUE;
@ -816,8 +816,8 @@ retry:
fio_flags = 0;
converted = need_conversion(fenc);
if (converted) {
/* "ucs-bom" means we need to check the first bytes of the file
* for a BOM. */
// "ucs-bom" means we need to check the first bytes of the file
// for a BOM.
if (STRCMP(fenc, ENC_UCSBOM) == 0) {
fio_flags = FIO_UCSBOM;
} else {
@ -949,16 +949,16 @@ retry:
ptr = buffer + linerest;
line_start = buffer;
/* May need room to translate into.
* For iconv() we don't really know the required space, use a
* factor ICONV_MULT.
* latin1 to utf-8: 1 byte becomes up to 2 bytes
* utf-16 to utf-8: 2 bytes become up to 3 bytes, 4 bytes
* become up to 4 bytes, size must be multiple of 2
* ucs-2 to utf-8: 2 bytes become up to 3 bytes, size must be
* multiple of 2
* ucs-4 to utf-8: 4 bytes become up to 6 bytes, size must be
* multiple of 4 */
// May need room to translate into.
// For iconv() we don't really know the required space, use a
// factor ICONV_MULT.
// latin1 to utf-8: 1 byte becomes up to 2 bytes
// utf-16 to utf-8: 2 bytes become up to 3 bytes, 4 bytes
// become up to 4 bytes, size must be multiple of 2
// ucs-2 to utf-8: 2 bytes become up to 3 bytes, size must be
// multiple of 2
// ucs-4 to utf-8: 4 bytes become up to 6 bytes, size must be
// multiple of 4
real_size = (int)size;
#ifdef HAVE_ICONV
if (iconv_fd != (iconv_t)-1) {
@ -1000,9 +1000,9 @@ retry:
p = ml_get(read_buf_lnum) + read_buf_col;
n = (int)STRLEN(p);
if ((int)tlen + n + 1 > size) {
/* Filled up to "size", append partial line.
* Change NL to NUL to reverse the effect done
* below. */
// Filled up to "size", append partial line.
// Change NL to NUL to reverse the effect done
// below.
n = (int)(size - tlen);
for (ni = 0; ni < n; ++ni) {
if (p[ni] == NL) {
@ -1026,8 +1026,8 @@ retry:
ptr[tlen++] = NL;
read_buf_col = 0;
if (++read_buf_lnum > from) {
/* When the last line didn't have an
* end-of-line don't add it now either. */
// When the last line didn't have an
// end-of-line don't add it now either.
if (!curbuf->b_p_eol) {
--tlen;
}
@ -1279,8 +1279,8 @@ retry:
}
}
/* If there is a trailing incomplete sequence move it to
* conv_rest[]. */
// If there is a trailing incomplete sequence move it to
// conv_rest[].
if (tail != NULL) {
conv_restlen = (int)((ptr + size) - tail);
memmove(conv_rest, tail, conv_restlen);
@ -1320,8 +1320,8 @@ retry:
}
}
/* found second word of double-word, get the first
* word and compute the resulting character */
// found second word of double-word, get the first
// word and compute the resulting character
if (fio_flags & FIO_ENDIAN_L) {
u16c = (*--p << 8);
u16c += *--p;
@ -1369,9 +1369,9 @@ retry:
p -= len;
u8c = utf_ptr2char(p);
if (len == 0) {
/* Not a valid UTF-8 character, retry with
* another fenc when possible, otherwise just
* report the error. */
// Not a valid UTF-8 character, retry with
// another fenc when possible, otherwise just
// report the error.
if (can_retry) {
goto rewind_retry;
}
@ -1435,9 +1435,9 @@ retry:
}
}
if (l == 1 || l > todo) {
/* Illegal byte. If we can try another encoding
* do that, unless at EOF where a truncated
* file is more likely than a conversion error. */
// Illegal byte. If we can try another encoding
// do that, unless at EOF where a truncated
// file is more likely than a conversion error.
if (can_retry && !incomplete_tail) {
break;
}
@ -1909,8 +1909,8 @@ failed:
*/
curbuf->b_no_eol_lnum = read_no_eol_lnum;
/* When reloading a buffer put the cursor at the first line that is
* different. */
// When reloading a buffer put the cursor at the first line that is
// different.
if (flags & READ_KEEP_UNDO) {
u_find_first_changed();
}
@ -1929,8 +1929,8 @@ failed:
int m = msg_scroll;
int n = msg_scrolled;
/* Save the fileformat now, otherwise the buffer will be considered
* modified if the format/encoding was automatically detected. */
// Save the fileformat now, otherwise the buffer will be considered
// modified if the format/encoding was automatically detected.
if (set_options) {
save_file_ff(curbuf);
}
@ -4804,15 +4804,15 @@ int check_timestamps(int focus)
{
int didit = 0;
/* Don't check timestamps while system() or another low-level function may
* cause us to lose and gain focus. */
// Don't check timestamps while system() or another low-level function may
// cause us to lose and gain focus.
if (no_check_timestamps > 0) {
return FALSE;
}
/* Avoid doing a check twice. The OK/Reload dialog can cause a focus
* event and we would keep on checking if the file is steadily growing.
* Do check again after typing something. */
// Avoid doing a check twice. The OK/Reload dialog can cause a focus
// event and we would keep on checking if the file is steadily growing.
// Do check again after typing something.
if (focus && did_check_timestamps) {
need_check_timestamps = TRUE;
return FALSE;
@ -5025,8 +5025,8 @@ int buf_check_timestamp(buf_T *buf)
mesg = _("W16: Warning: Mode of file \"%s\" has changed since editing started");
mesg2 = _("See \":help W16\" for more info.");
} else {
/* Only timestamp changed, store it to avoid a warning
* in check_mtime() later. */
// Only timestamp changed, store it to avoid a warning
// in check_mtime() later.
buf->b_mtime_read = buf->b_mtime;
}
}
@ -5623,12 +5623,11 @@ char_u *file_pat_to_reg_pat(const char_u *pat, const char_u *pat_end, char *allo
}
#ifdef BACKSLASH_IN_FILENAME
if (!no_bslash) {
/* translate:
* "\x" to "\\x" e.g., "dir\file"
* "\*" to "\\.*" e.g., "dir\*.c"
* "\?" to "\\." e.g., "dir\??.c"
* "\+" to "\+" e.g., "fileX\+.c"
*/
// translate:
// "\x" to "\\x" e.g., "dir\file"
// "\*" to "\\.*" e.g., "dir\*.c"
// "\?" to "\\." e.g., "dir\??.c"
// "\+" to "\+" e.g., "fileX\+.c"
if ((vim_isfilec(p[1]) || p[1] == '*' || p[1] == '?')
&& p[1] != '+') {
reg_pat[i++] = '[';
@ -5642,16 +5641,15 @@ char_u *file_pat_to_reg_pat(const char_u *pat, const char_u *pat_end, char *allo
}
}
#endif
/* Undo escaping from ExpandEscape():
* foo\?bar -> foo?bar
* foo\%bar -> foo%bar
* foo\,bar -> foo,bar
* foo\ bar -> foo bar
* Don't unescape \, * and others that are also special in a
* regexp.
* An escaped { must be unescaped since we use magic not
* verymagic. Use "\\\{n,m\}"" to get "\{n,m}".
*/
// Undo escaping from ExpandEscape():
// foo\?bar -> foo?bar
// foo\%bar -> foo%bar
// foo\,bar -> foo,bar
// foo\ bar -> foo bar
// Don't unescape \, * and others that are also special in a
// regexp.
// An escaped { must be unescaped since we use magic not
// verymagic. Use "\\\{n,m\}"" to get "\{n,m}".
if (*++p == '?'
#ifdef BACKSLASH_IN_FILENAME
&& no_bslash

View File

@ -224,8 +224,8 @@ bool hasFoldingWin(win_T *const win, const linenr_T lnum, linenr_T *const firstp
break;
}
/* Fold found, but it's open: Check nested folds. Line number is
* relative to containing fold. */
// Fold found, but it's open: Check nested folds. Line number is
// relative to containing fold.
gap = &fp->fd_nested;
lnum_rel -= fp->fd_top;
++level;
@ -264,8 +264,8 @@ bool hasFoldingWin(win_T *const win, const linenr_T lnum, linenr_T *const firstp
*/
int foldLevel(linenr_T lnum)
{
/* While updating the folds lines between invalid_top and invalid_bot have
* an undefined fold level. Otherwise update the folds first. */
// While updating the folds lines between invalid_top and invalid_bot have
// an undefined fold level. Otherwise update the folds first.
if (invalid_top == (linenr_T)0) {
checkupdate(curwin);
} else if (lnum == prev_lnum && prev_lnum_lvl >= 0) {
@ -492,9 +492,9 @@ static void newFoldLevelWin(win_T *wp)
checkupdate(wp);
if (wp->w_fold_manual) {
/* Set all flags for the first level of folds to FD_LEVEL. Following
* manual open/close will then change the flags to FD_OPEN or
* FD_CLOSED for those folds that don't use 'foldlevel'. */
// Set all flags for the first level of folds to FD_LEVEL. Following
// manual open/close will then change the flags to FD_OPEN or
// FD_CLOSED for those folds that don't use 'foldlevel'.
fp = (fold_T *)wp->w_folds.ga_data;
for (int i = 0; i < wp->w_folds.ga_len; ++i) {
fp[i].fd_flags = FD_LEVEL;
@ -904,8 +904,8 @@ int foldMoveTo(const bool updown, const int dir, const long count)
break;
}
/* When moving up, consider a fold above the cursor; when
* moving down consider a fold below the cursor. */
// When moving up, consider a fold above the cursor; when
// moving down consider a fold below the cursor.
if (dir == FORWARD) {
if (fp - (fold_T *)gap->ga_data >= gap->ga_len) {
break;
@ -1424,13 +1424,13 @@ void deleteFoldRecurse(buf_T *bp, garray_T *gap)
*/
void foldMarkAdjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)
{
/* If deleting marks from line1 to line2, but not deleting all those
* lines, set line2 so that only deleted lines have their folds removed. */
// If deleting marks from line1 to line2, but not deleting all those
// lines, set line2 so that only deleted lines have their folds removed.
if (amount == MAXLNUM && line2 >= line1 && line2 - line1 >= -amount_after) {
line2 = line1 - amount_after - 1;
}
/* If appending a line in Insert mode, it should be included in the fold
* just above the line. */
// If appending a line in Insert mode, it should be included in the fold
// just above the line.
if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) {
line1--;
}
@ -1449,8 +1449,8 @@ static void foldMarkAdjustRecurse(win_T *wp, garray_T *gap, linenr_T line1, line
return;
}
/* In Insert mode an inserted line at the top of a fold is considered part
* of the fold, otherwise it isn't. */
// In Insert mode an inserted line at the top of a fold is considered part
// of the fold, otherwise it isn't.
if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) {
top = line1 + 1;
} else {
@ -1580,8 +1580,8 @@ static bool check_closed(win_T *const wp, fold_T *const fp, bool *const use_leve
{
bool closed = false;
/* Check if this fold is closed. If the flag is FD_LEVEL this
* fold and all folds it contains depend on 'foldlevel'. */
// Check if this fold is closed. If the flag is FD_LEVEL this
// fold and all folds it contains depend on 'foldlevel'.
if (*use_levelp || fp->fd_flags == FD_LEVEL) {
*use_levelp = true;
if (level >= wp->w_p_fdl) {
@ -2036,8 +2036,8 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
// Init marker variables to speed up foldlevelMarker().
parseMarker(wp);
/* Need to get the level of the line above top, it is used if there is
* no marker at the top. */
// Need to get the level of the line above top, it is used if there is
// no marker at the top.
if (top > 1) {
// Get the fold level at top - 1.
const int level = foldLevelWin(wp, top - 1);
@ -2047,9 +2047,9 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
fline.lvl = level;
getlevel(&fline);
/* If a fold started here, we already had the level, if it stops
* here, we need to use lvl_next. Could also start and end a fold
* in the same line. */
// If a fold started here, we already had the level, if it stops
// here, we need to use lvl_next. Could also start and end a fold
// in the same line.
if (fline.lvl > level) {
fline.lvl = level - (fline.lvl - fline.lvl_next);
} else {
@ -2062,8 +2062,8 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
fline.lnum = top;
if (foldmethodIsExpr(wp)) {
getlevel = foldlevelExpr;
/* start one line back, because a "<1" may indicate the end of a
* fold in the topline */
// start one line back, because a "<1" may indicate the end of a
// fold in the topline
if (top > 1) {
--fline.lnum;
}
@ -2152,9 +2152,9 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
end = fp->fd_top + fp->fd_len - 1;
} else if (getlevel == foldlevelSyntax
&& foldLevelWin(wp, fline.lnum) != fline.lvl) {
/* For "syntax" method: Compare the foldlevel that the syntax
* tells us to the foldlevel from the existing folds. If they
* don't match continue updating folds. */
// For "syntax" method: Compare the foldlevel that the syntax
// tells us to the foldlevel from the existing folds. If they
// don't match continue updating folds.
end = fline.lnum;
} else {
break;
@ -2186,9 +2186,9 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
changed_window_setting_win(wp);
}
/* If we updated folds past "bot", need to redraw more lines. Don't do
* this in other situations, the changed lines will be redrawn anyway and
* this method can cause the whole window to be updated. */
// If we updated folds past "bot", need to redraw more lines. Don't do
// this in other situations, the changed lines will be redrawn anyway and
// this method can cause the whole window to be updated.
if (end != bot) {
if (wp->w_redraw_top == 0 || wp->w_redraw_top > top) {
wp->w_redraw_top = top;
@ -2273,10 +2273,10 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
// Updating folds can be slow, check for CTRL-C.
line_breakcheck();
/* Set "lvl" to the level of line "flp->lnum". When flp->start is set
* and after the first line of the fold, set the level to zero to
* force the fold to end. Do the same when had_end is set: Previous
* line was marked as end of a fold. */
// Set "lvl" to the level of line "flp->lnum". When flp->start is set
// and after the first line of the fold, set the level to zero to
// force the fold to end. Do the same when had_end is set: Previous
// line was marked as end of a fold.
lvl = flp->lvl;
if (lvl > MAX_LEVEL) {
lvl = MAX_LEVEL;
@ -2287,12 +2287,11 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
}
if (flp->lnum > bot && !finish && fp != NULL) {
/* For "marker" and "syntax" methods:
* - If a change caused a nested fold to be removed, we need to
* delete it and continue at least until where it ended.
* - If a change caused a nested fold to be created, or this fold
* to continue below its original end, need to finish this fold.
*/
// For "marker" and "syntax" methods:
// - If a change caused a nested fold to be removed, we need to
// delete it and continue at least until where it ended.
// - If a change caused a nested fold to be created, or this fold
// to continue below its original end, need to finish this fold.
if (getlevel != foldlevelMarker
&& getlevel != foldlevelExpr
&& getlevel != foldlevelSyntax) {
@ -2301,9 +2300,9 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
i = 0;
fp2 = fp;
if (lvl >= level) {
/* Compute how deep the folds currently are, if it's deeper
* than "lvl" then some must be deleted, need to update
* at least one nested fold. */
// Compute how deep the folds currently are, if it's deeper
// than "lvl" then some must be deleted, need to update
// at least one nested fold.
ll = flp->lnum - fp->fd_top;
while (foldFind(&fp2->fd_nested, ll, &fp2)) {
++i;
@ -2322,9 +2321,9 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
}
}
/* At the start of the first nested fold and at the end of the current
* fold: check if existing folds at this level, before the current
* one, need to be deleted or truncated. */
// At the start of the first nested fold and at the end of the current
// fold: check if existing folds at this level, before the current
// one, need to be deleted or truncated.
if (fp == NULL
&& (lvl != level
|| flp->lnum_save >= bot
@ -2357,10 +2356,10 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
|| (lvl >= level
&& fp->fd_top <= flp->lnum_save))))) {
if (fp->fd_top + fp->fd_len + concat > firstlnum) {
/* Use existing fold for the new fold. If it starts
* before where we started looking, extend it. If it
* starts at another line, update nested folds to keep
* their position, compensating for the new fd_top. */
// Use existing fold for the new fold. If it starts
// before where we started looking, extend it. If it
// starts at another line, update nested folds to keep
// their position, compensating for the new fd_top.
if (fp->fd_top == firstlnum) {
// We have found a fold beginning exactly where we want one.
} else if (fp->fd_top >= startlnum) {
@ -2504,8 +2503,8 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
bot = flp->lnum;
}
/* Line numbers in the nested fold are relative to the start of
* this fold. */
// Line numbers in the nested fold are relative to the start of
// this fold.
flp->lnum = flp->lnum_save - fp->fd_top;
flp->off += fp->fd_top;
i = (int)(fp - (fold_T *)gap->ga_data);
@ -2548,8 +2547,8 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
break;
}
/* leave flp->lnum_save to lnum of the line that was used to get
* the level, flp->lnum to the lnum of the next line. */
// leave flp->lnum_save to lnum of the line that was used to get
// the level, flp->lnum to the lnum of the next line.
flp->lnum_save = flp->lnum;
flp->lnum = ll;
}
@ -2634,8 +2633,8 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
deleteFoldEntry(flp->wp, gap, (int)(fp2 - (fold_T *)gap->ga_data), true);
}
/* Need to redraw the lines we inspected, which might be further down than
* was asked for. */
// Need to redraw the lines we inspected, which might be further down than
// was asked for.
if (bot < flp->lnum - 1) {
bot = flp->lnum - 1;
}
@ -2948,8 +2947,8 @@ static void foldMerge(win_T *const wp, fold_T *fp1, garray_T *gap, fold_T *fp2)
garray_T *gap1 = &fp1->fd_nested;
garray_T *gap2 = &fp2->fd_nested;
/* If the last nested fold in fp1 touches the first nested fold in fp2,
* merge them recursively. */
// If the last nested fold in fp1 touches the first nested fold in fp2,
// merge them recursively.
if (foldFind(gap1, fp1->fd_len - 1L, &fp3) && foldFind(gap2, 0L, &fp4)) {
foldMerge(wp, fp3, gap2, fp4);
}
@ -2986,8 +2985,8 @@ static void foldlevelIndent(fline_T *flp)
buf = flp->wp->w_buffer;
s = skipwhite(ml_get_buf(buf, lnum, false));
/* empty line or lines starting with a character in 'foldignore': level
* depends on surrounding lines */
// empty line or lines starting with a character in 'foldignore': level
// depends on surrounding lines
if (*s == NUL || vim_strchr(flp->wp->w_p_fdi, *s) != NULL) {
// first and last line can't be undefined, use level 0
if (lnum == 1 || lnum == buf->b_ml.ml_line_count) {
@ -3090,8 +3089,8 @@ static void foldlevelExpr(fline_T *flp)
// "-1", "0", "1", ..: set fold level
default:
if (n < 0) {
/* Use the current level for the next line, so that "a1"
* will work there. */
// Use the current level for the next line, so that "a1"
// will work there.
flp->lvl_next = flp->lvl;
} else {
flp->lvl_next = n;
@ -3100,8 +3099,8 @@ static void foldlevelExpr(fline_T *flp)
break;
}
/* If the level is unknown for the first or the last line in the file, use
* level 0. */
// If the level is unknown for the first or the last line in the file, use
// level 0.
if (flp->lvl < 0) {
if (lnum <= 1) {
flp->lvl = 0;