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-20 16:38:54 +02:00
parent 122c0dfb5d
commit f677ba4dab
6 changed files with 304 additions and 319 deletions

View File

@ -1082,8 +1082,8 @@ void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
curwin->w_cursor.lnum = n;
while (line1 <= line2) {
/* need to use vim_strsave() because the line will be unlocked within
* ml_append() */
// need to use vim_strsave() because the line will be unlocked within
// ml_append()
p = vim_strsave(ml_get(line1));
ml_append(curwin->w_cursor.lnum, p, (colnr_T)0, false);
xfree(p);
@ -1206,9 +1206,9 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
prevcmd = newcmd;
if (bangredo) { // put cmd in redo buffer for ! command
/* If % or # appears in the command, it must have been escaped.
* Reescape them, so that redoing them does not substitute them by the
* buffername. */
// If % or # appears in the command, it must have been escaped.
// Reescape them, so that redoing them does not substitute them by the
// buffername.
char_u *cmd = vim_strsave_escaped(prevcmd, (char_u *)"%#");
AppendToRedobuffLit(cmd, -1);
@ -1237,8 +1237,8 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
do_shell(newcmd, 0);
} else { // :range!
/* Careful: This may recursively call do_bang() again! (because of
* autocommands) */
// Careful: This may recursively call do_bang() again! (because of
// autocommands)
do_filter(line1, line2, eap, newcmd, do_in, do_out);
apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, false, curbuf);
}
@ -1368,9 +1368,9 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd,
did_check_timestamps = FALSE;
need_check_timestamps = TRUE;
/* When interrupting the shell command, it may still have produced some
* useful output. Reset got_int here, so that readfile() won't cancel
* reading. */
// When interrupting the shell command, it may still have produced some
// useful output. Reset got_int here, so that readfile() won't cancel
// reading.
os_breakcheck();
got_int = FALSE;
@ -1837,8 +1837,8 @@ int do_write(exarg_T *eap)
alt_buf = buflist_findname(ffname);
}
if (alt_buf != NULL && alt_buf->b_ml.ml_mfp != NULL) {
/* Overwriting a file that is loaded in another buffer is not a
* good idea. */
// Overwriting a file that is loaded in another buffer is not a
// good idea.
EMSG(_(e_bufloaded));
goto theend;
}
@ -2143,8 +2143,8 @@ int not_writing(void)
*/
static int check_readonly(int *forceit, buf_T *buf)
{
/* Handle a file being readonly when the 'readonly' option is set or when
* the file exists and permissions are read-only. */
// Handle a file being readonly when the 'readonly' option is set or when
// the file exists and permissions are read-only.
if (!*forceit && (buf->b_p_ro
|| (os_path_exists(buf->b_ffname)
&& !os_file_is_writable((char *)buf->b_ffname)))) {
@ -2612,8 +2612,8 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
set_buflisted(TRUE);
}
/* If autocommands change buffers under our fingers, forget about
* editing the file. */
// If autocommands change buffers under our fingers, forget about
// editing the file.
if (buf != curbuf) {
goto theend;
}
@ -2677,9 +2677,9 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
}
xfree(new_name);
/* If autocommands change buffers under our fingers, forget about
* re-editing the file. Should do the buf_clear_file(), but perhaps
* the autocommands changed the buffer... */
// If autocommands change buffers under our fingers, forget about
// re-editing the file. Should do the buf_clear_file(), but perhaps
// the autocommands changed the buffer...
if (buf != curbuf) {
goto theend;
}
@ -2711,8 +2711,8 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
*/
curwin_init();
/* It's possible that all lines in the buffer changed. Need to update
* automatic folding for all windows where it's used. */
// It's possible that all lines in the buffer changed. Need to update
// automatic folding for all windows where it's used.
FOR_ALL_TAB_WINDOWS(tp, win) {
if (win->w_buffer == curbuf) {
foldUpdateAll(win);
@ -2744,9 +2744,9 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
}
handle_swap_exists(&old_curbuf);
} else {
/* Read the modelines, but only to set window-local options. Any
* buffer-local options have already been set and may have been
* changed by the user. */
// Read the modelines, but only to set window-local options. Any
// buffer-local options have already been set and may have been
// changed by the user.
do_modelines(OPT_WINONLY);
apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf,
@ -2778,16 +2778,16 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
maketitle();
}
/* Tell the diff stuff that this buffer is new and/or needs updating.
* Also needed when re-editing the same buffer, because unloading will
* have removed it as a diff buffer. */
// Tell the diff stuff that this buffer is new and/or needs updating.
// Also needed when re-editing the same buffer, because unloading will
// have removed it as a diff buffer.
if (curwin->w_p_diff) {
diff_buf_add(curbuf);
diff_invalidate(curbuf);
}
/* If the window options were changed may need to set the spell language.
* Can only do this after the buffer has been properly setup. */
// If the window options were changed may need to set the spell language.
// Can only do this after the buffer has been properly setup.
if (did_get_winopts && curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) {
(void)did_set_spelllang(curwin);
}
@ -3022,10 +3022,10 @@ void ex_append(exarg_T *eap)
curbuf->b_p_ai = !curbuf->b_p_ai;
}
/* "start" is set to eap->line2+1 unless that position is invalid (when
* eap->line2 pointed to the end of the buffer and nothing was appended)
* "end" is set to lnum when something has been appended, otherwise
* it is the same than "start" -- Acevedo */
// "start" is set to eap->line2+1 unless that position is invalid (when
// eap->line2 pointed to the end of the buffer and nothing was appended)
// "end" is set to lnum when something has been appended, otherwise
// it is the same than "start" -- Acevedo
curbuf->b_op_start.lnum = (eap->line2 < curbuf->b_ml.ml_line_count) ?
eap->line2 + 1 : curbuf->b_ml.ml_line_count;
if (eap->cmdidx != CMD_append) {
@ -3555,8 +3555,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
pat = NULL; // search_regcomp() will use previous pattern
sub = (char_u *)old_sub.sub;
/* Vi compatibility quirk: repeating with ":s" keeps the cursor in the
* last column after using "$". */
// Vi compatibility quirk: repeating with ":s" keeps the cursor in the
// last column after using "$".
endcolumn = (curwin->w_curswant == MAXCOL);
}
@ -3807,8 +3807,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
if (subflags.do_ask && !preview) {
int typed = 0;
/* change State to CONFIRM, so that the mouse works
* properly */
// change State to CONFIRM, so that the mouse works
// properly
int save_State = State;
State = CONFIRM;
setmouse(); // disable mouse in xterm
@ -3864,9 +3864,9 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
const bool save_p_lz = p_lz;
int save_p_fen = curwin->w_p_fen;
curwin->w_p_fen = FALSE;
/* Invert the matched string.
* Remove the inversion afterwards. */
curwin->w_p_fen = false;
// Invert the matched string.
// Remove the inversion afterwards.
int temp = RedrawingDisabled;
RedrawingDisabled = 0;
@ -3874,11 +3874,11 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
p_lz = false;
if (new_start != NULL) {
/* There already was a substitution, we would
* like to show this to the user. We cannot
* really update the line, it would change
* what matches. Temporarily replace the line
* and change it back afterwards. */
// There already was a substitution, we would
// like to show this to the user. We cannot
// really update the line, it would change
// what matches. Temporarily replace the line
// and change it back afterwards.
orig_line = vim_strsave(ml_get(lnum));
char_u *new_line = concat_str(new_start, sub_firstline + copycol);
@ -3908,8 +3908,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
}
msg_starthere();
i = msg_scroll;
msg_scroll = 0; /* truncate msg when
needed */
msg_scroll = 0; // truncate msg when
// needed
msg_no_more = true;
msg_ext_set_kind("confirm_sub");
smsg_attr(HL_ATTR(HLF_R), // Same highlight as wait_return().
@ -4878,8 +4878,8 @@ void ex_help(exarg_T *eap)
if (!p_im) {
restart_edit = 0; // don't want insert mode in help file
}
/* Restore KeyTyped, setting 'filetype=help' may reset it.
* It is needed for do_tag top open folds under the cursor. */
// Restore KeyTyped, setting 'filetype=help' may reset it.
// It is needed for do_tag top open folds under the cursor.
KeyTyped = old_KeyTyped;
do_tag(tag, DT_HELP, 1, FALSE, TRUE);
@ -5073,11 +5073,10 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, bool
STRCPY(d + 4, "\\$");
}
} else {
/* Replace:
* "[:...:]" with "\[:...:]"
* "[++...]" with "\[++...]"
* "\{" with "\\{" -- matching "} \}"
*/
// Replace:
// "[:...:]" with "\[:...:]"
// "[++...]" with "\[++...]"
// "\{" with "\\{" -- matching "} \}"
if ((arg[0] == '[' && (arg[1] == ':'
|| (arg[1] == '+' && arg[2] == '+')))
|| (arg[0] == '\\' && arg[1] == '{')) {
@ -5327,8 +5326,8 @@ void fix_help_buffer(void)
continue;
}
/* Go through all directories in 'runtimepath', skipping
* $VIMRUNTIME. */
// Go through all directories in 'runtimepath', skipping
// $VIMRUNTIME.
char_u *p = p_rtp;
while (*p != NUL) {
copy_option_part(&p, NameBuff, MAXPATHL, ",");
@ -5413,10 +5412,9 @@ void fix_help_buffer(void)
if (*s == '\r' || *s == '\n') {
*s = NUL;
}
/* The text is utf-8 when a byte
* above 127 is found and no
* illegal byte sequence is found.
*/
// The text is utf-8 when a byte
// above 127 is found and no
// illegal byte sequence is found.
if (*s >= 0x80 && this_utf != kFalse) {
this_utf = kTrue;
const int l = utf_ptr2len(s);
@ -5427,9 +5425,9 @@ void fix_help_buffer(void)
}
++s;
}
/* The help file is latin1 or utf-8;
* conversion to the current
* 'encoding' may be required. */
// The help file is latin1 or utf-8;
// conversion to the current
// 'encoding' may be required.
vc.vc_type = CONV_NONE;
convert_setup(&vc,
(char_u *)(this_utf == kTrue ? "utf-8" : "latin1"),
@ -5716,8 +5714,8 @@ static void do_helptags(char_u *dirname, bool add_help_tags, bool ignore_writeer
return;
}
/* Go over all files in the directory to find out what languages are
* present. */
// Go over all files in the directory to find out what languages are
// present.
int j;
ga_init(&ga, 1, 10);
for (int i = 0; i < filecount; i++) {

View File

@ -340,12 +340,12 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
int getline_is_func;
static int call_depth = 0; // recursiveness
/* For every pair of do_cmdline()/do_one_cmd() calls, use an extra memory
* location for storing error messages to be converted to an exception.
* This ensures that the do_errthrow() call in do_one_cmd() does not
* combine the messages stored by an earlier invocation of do_one_cmd()
* with the command name of the later one. This would happen when
* BufWritePost autocommands are executed after a write error. */
// For every pair of do_cmdline()/do_one_cmd() calls, use an extra memory
// location for storing error messages to be converted to an exception.
// This ensures that the do_errthrow() call in do_one_cmd() does not
// combine the messages stored by an earlier invocation of do_one_cmd()
// with the command name of the later one. This would happen when
// BufWritePost autocommands are executed after a write error.
saved_msg_list = msg_list;
msg_list = &private_msg_list;
private_msg_list = NULL;
@ -445,12 +445,12 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
// 1. If repeating, get a previous line from lines_ga.
if (cstack.cs_looplevel > 0 && current_line < lines_ga.ga_len) {
/* Each '|' separated command is stored separately in lines_ga, to
* be able to jump to it. Don't use next_cmdline now. */
// Each '|' separated command is stored separately in lines_ga, to
// be able to jump to it. Don't use next_cmdline now.
XFREE_CLEAR(cmdline_copy);
/* Check if a function has returned or, unless it has an unclosed
* try conditional, aborted. */
// Check if a function has returned or, unless it has an unclosed
// try conditional, aborted.
if (getline_is_func) {
if (do_profiling == PROF_YES) {
func_line_end(real_cookie);
@ -630,8 +630,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
new_last_cmdline = NULL;
}
} else {
/* need to copy the command after the '|' to cmdline_copy, for the
* next do_one_cmd() */
// need to copy the command after the '|' to cmdline_copy, for the
// next do_one_cmd()
STRMOVE(cmdline_copy, next_cmdline);
next_cmdline = cmdline_copy;
}
@ -656,10 +656,10 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
if (cstack.cs_lflags & (CSL_HAD_CONT | CSL_HAD_ENDLOOP)) {
cstack.cs_lflags &= ~(CSL_HAD_CONT | CSL_HAD_ENDLOOP);
/* Jump back to the matching ":while" or ":for". Be careful
* not to use a cs_line[] from an entry that isn't a ":while"
* or ":for": It would make "current_line" invalid and can
* cause a crash. */
// Jump back to the matching ":while" or ":for". Be careful
// not to use a cs_line[] from an entry that isn't a ":while"
// or ":for": It would make "current_line" invalid and can
// cause a crash.
if (!did_emsg && !got_int && !current_exception
&& cstack.cs_idx >= 0
&& (cstack.cs_flags[cstack.cs_idx]
@ -752,9 +752,9 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
while (!((got_int || (did_emsg && force_abort) || current_exception)
&& cstack.cs_trylevel == 0)
&& !(did_emsg
/* Keep going when inside try/catch, so that the error can be
* deal with, except when it is a syntax error, it may cause
* the :endtry to be missed. */
// Keep going when inside try/catch, so that the error can be
// deal with, except when it is a syntax error, it may cause
// the :endtry to be missed.
&& (cstack.cs_trylevel == 0 || did_emsg_syntax)
&& used_getline
&& getline_equal(fgetline, cookie, getexline))
@ -2880,8 +2880,8 @@ int cmd_exists(const char *const name)
}
}
/* Check built-in commands and user defined commands.
* For ":2match" and ":3match" we need to skip the number. */
// Check built-in commands and user defined commands.
// For ":2match" and ":3match" we need to skip the number.
ea.cmd = (char_u *)((*name == '2' || *name == '3') ? name + 1 : name);
ea.cmdidx = (cmdidx_T)0;
int full = false;
@ -3963,8 +3963,8 @@ static linenr_T get_address(exarg_T *eap, char_u **ptr, cmd_addr_T addr_type, in
if (skip) {
++cmd;
} else {
/* Only accept a mark in another file when it is
* used by itself: ":'M". */
// Only accept a mark in another file when it is
// used by itself: ":'M".
fp = getmark(*cmd, to_other_file && cmd[1] == NUL);
++cmd;
if (fp == (pos_T *)-1) {
@ -4444,11 +4444,10 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
xfree(l);
}
/* Need to escape white space et al. with a backslash.
* Don't do this for:
* - replacement that already has been escaped: "##"
* - shell commands (may have to use quotes instead).
*/
// Need to escape white space et al. with a backslash.
// Don't do this for:
// - replacement that already has been escaped: "##"
// - shell commands (may have to use quotes instead).
if (!eap->usefilter
&& !escaped
&& eap->cmdidx != CMD_bang
@ -4794,8 +4793,8 @@ static int getargopt(exarg_T *eap)
*p = TOLOWER_ASC(*p);
}
} else {
/* Check ++bad= argument. Must be a single-byte character, "keep" or
* "drop". */
// Check ++bad= argument. Must be a single-byte character, "keep" or
// "drop".
if (get_bad_opt(eap->cmd + bad_char_idx, eap) == FAIL) {
return FAIL;
}
@ -6772,15 +6771,15 @@ void tabpage_close_other(tabpage_T *tp, int forceit)
int h = tabline_height();
char_u prev_idx[NUMBUFLEN];
/* Limit to 1000 windows, autocommands may add a window while we close
* one. OK, so I'm paranoid... */
// Limit to 1000 windows, autocommands may add a window while we close
// one. OK, so I'm paranoid...
while (++done < 1000) {
snprintf((char *)prev_idx, sizeof(prev_idx), "%i", tabpage_index(tp));
wp = tp->tp_lastwin;
ex_win_close(forceit, wp, tp);
/* Autocommands may delete the tab page under our fingers and we may
* fail to close a window with a modified buffer. */
// Autocommands may delete the tab page under our fingers and we may
// fail to close a window with a modified buffer.
if (!valid_tabpage(tp) || tp->tp_firstwin == wp) {
break;
}
@ -7166,8 +7165,8 @@ void ex_splitview(exarg_T *eap)
|| eap->cmdidx == CMD_tabfind
|| eap->cmdidx == CMD_tabnew;
/* A ":split" in the quickfix window works like ":new". Don't want two
* quickfix windows. But it's OK when doing ":tab split". */
// A ":split" in the quickfix window works like ":new". Don't want two
// quickfix windows. But it's OK when doing ":tab split".
if (bt_quickfix(curbuf) && cmdmod.tab == 0) {
if (eap->cmdidx == CMD_split) {
eap->cmdidx = CMD_new;
@ -7514,18 +7513,18 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
enter_cleanup(&cs);
win_close(curwin, !need_hide && !buf_hide(curbuf));
/* Restore the error/interrupt/exception state if not
* discarded by a new aborting error, interrupt, or
* uncaught exception. */
// Restore the error/interrupt/exception state if not
// discarded by a new aborting error, interrupt, or
// uncaught exception.
leave_cleanup(&cs);
}
}
} else if (readonlymode && curbuf->b_nwindows == 1) {
/* When editing an already visited buffer, 'readonly' won't be set
* but the previous value is kept. With ":view" and ":sview" we
* want the file to be readonly, except when another window is
* editing the same buffer. */
curbuf->b_p_ro = TRUE;
// When editing an already visited buffer, 'readonly' won't be set
// but the previous value is kept. With ":view" and ":sview" we
// want the file to be readonly, except when another window is
// editing the same buffer.
curbuf->b_p_ro = true;
}
readonlymode = n;
} else {

View File

@ -406,9 +406,9 @@ char_u *get_exception_string(void *value, except_type_T type, char_u *cmdname, i
val = ret + 4;
}
/* msg_add_fname may have been used to prefix the message with a file
* name in quotes. In the exception value, put the file name in
* parentheses and move it to the end. */
// msg_add_fname may have been used to prefix the message with a file
// name in quotes. In the exception value, put the file name in
// parentheses and move it to the end.
for (p = mesg;; p++) {
if (*p == NUL
|| (*p == 'E'
@ -922,16 +922,14 @@ void ex_else(exarg_T *eap)
cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE;
}
/*
* When debugging or a breakpoint was encountered, display the debug prompt
* (if not already done). This shows the user that an ":else" or ":elseif"
* is executed when the ":if" or previous ":elseif" was not TRUE. Handle
* a ">quit" debug command as if an interrupt had occurred before the
* ":else" or ":elseif". That is, set "skip" and throw an interrupt
* exception if appropriate. Doing this here prevents that an exception
* for a parsing errors is discarded when throwing the interrupt exception
* later on.
*/
// When debugging or a breakpoint was encountered, display the debug prompt
// (if not already done). This shows the user that an ":else" or ":elseif"
// is executed when the ":if" or previous ":elseif" was not TRUE. Handle
// a ">quit" debug command as if an interrupt had occurred before the
// ":else" or ":elseif". That is, set "skip" and throw an interrupt
// exception if appropriate. Doing this here prevents that an exception
// for a parsing errors is discarded when throwing the interrupt exception
// later on.
if (!skip && dbg_check_skipped(eap) && got_int) {
(void)do_intthrow(cstack);
skip = TRUE;
@ -1055,11 +1053,11 @@ void ex_continue(exarg_T *eap)
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
eap->errmsg = (char_u *)N_("E586: :continue without :while or :for");
} else {
/* Try to find the matching ":while". This might stop at a try
* conditional not in its finally clause (which is then to be executed
* next). Therefore, deactivate all conditionals except the ":while"
* itself (if reached). */
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE);
// Try to find the matching ":while". This might stop at a try
// conditional not in its finally clause (which is then to be executed
// next). Therefore, deactivate all conditionals except the ":while"
// itself (if reached).
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, false);
assert(idx >= 0);
if (cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR)) {
rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel);
@ -1070,8 +1068,8 @@ void ex_continue(exarg_T *eap)
*/
cstack->cs_lflags |= CSL_HAD_CONT; // let do_cmdline() handle it
} else {
/* If a try conditional not in its finally clause is reached first,
* make the ":continue" pending for execution at the ":endtry". */
// If a try conditional not in its finally clause is reached first,
// make the ":continue" pending for execution at the ":endtry".
cstack->cs_pending[idx] = CSTP_CONTINUE;
report_make_pending(CSTP_CONTINUE, NULL);
}
@ -1092,7 +1090,7 @@ void ex_break(exarg_T *eap)
// Deactivate conditionals until the matching ":while" or a try
// conditional not in its finally clause (which is then to be
// executed next) is found. In the latter case, make the ":break"
// pending for execution at the ":endtry". */
// pending for execution at the ":endtry".
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, true);
if (idx >= 0 && !(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) {
cstack->cs_pending[idx] = CSTP_BREAK;
@ -1155,20 +1153,17 @@ void ex_endwhile(exarg_T *eap)
// Cleanup and rewind all contained (and unclosed) conditionals.
(void)cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE);
rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel);
}
/*
* When debugging or a breakpoint was encountered, display the debug
* prompt (if not already done). This shows the user that an
* ":endwhile"/":endfor" is executed when the ":while" was not TRUE or
* after a ":break". Handle a ">quit" debug command as if an
* interrupt had occurred before the ":endwhile"/":endfor". That is,
* throw an interrupt exception if appropriate. Doing this here
* prevents that an exception for a parsing error is discarded when
* throwing the interrupt exception later on.
*/
else if (cstack->cs_flags[cstack->cs_idx] & CSF_TRUE
&& !(cstack->cs_flags[cstack->cs_idx] & CSF_ACTIVE)
&& dbg_check_skipped(eap)) {
} else if (cstack->cs_flags[cstack->cs_idx] & CSF_TRUE
&& !(cstack->cs_flags[cstack->cs_idx] & CSF_ACTIVE)
&& dbg_check_skipped(eap)) {
// When debugging or a breakpoint was encountered, display the debug
// prompt (if not already done). This shows the user that an
// ":endwhile"/":endfor" is executed when the ":while" was not TRUE or
// after a ":break". Handle a ">quit" debug command as if an
// interrupt had occurred before the ":endwhile"/":endfor". That is,
// throw an interrupt exception if appropriate. Doing this here
// prevents that an exception for a parsing error is discarded when
// throwing the interrupt exception later on.
(void)do_intthrow(cstack);
}
@ -1354,8 +1349,8 @@ void ex_catch(exarg_T *eap)
}
}
if (cstack->cs_flags[idx] & CSF_FINALLY) {
/* Give up for a ":catch" after ":finally" and ignore it.
* Just parse. */
// Give up for a ":catch" after ":finally" and ignore it.
// Just parse.
eap->errmsg = (char_u *)N_("E604: :catch after :finally");
give_up = TRUE;
} else {
@ -1395,16 +1390,16 @@ void ex_catch(exarg_T *eap)
return;
}
/* When debugging or a breakpoint was encountered, display the
* debug prompt (if not already done) before checking for a match.
* This is a helpful hint for the user when the regular expression
* matching fails. Handle a ">quit" debug command as if an
* interrupt had occurred before the ":catch". That is, discard
* the original exception, replace it by an interrupt exception,
* and don't catch it in this try block. */
// When debugging or a breakpoint was encountered, display the
// debug prompt (if not already done) before checking for a match.
// This is a helpful hint for the user when the regular expression
// matching fails. Handle a ">quit" debug command as if an
// interrupt had occurred before the ":catch". That is, discard
// the original exception, replace it by an interrupt exception,
// and don't catch it in this try block.
if (!dbg_check_skipped(eap) || !do_intthrow(cstack)) {
/* Terminate the pattern and avoid the 'l' flag in 'cpoptions'
* while compiling it. */
// Terminate the pattern and avoid the 'l' flag in 'cpoptions'
// while compiling it.
if (end != NULL) {
save_char = *end;
*end = NUL;
@ -1440,16 +1435,16 @@ void ex_catch(exarg_T *eap)
}
if (caught) {
/* Make this ":catch" clause active and reset did_emsg and got_int.
* Put the exception on the caught stack. */
// Make this ":catch" clause active and reset did_emsg and got_int.
// Put the exception on the caught stack.
cstack->cs_flags[idx] |= CSF_ACTIVE | CSF_CAUGHT;
did_emsg = got_int = false;
catch_exception((except_T *)cstack->cs_exception[idx]);
/* It's mandatory that the current exception is stored in the cstack
* so that it can be discarded at the next ":catch", ":finally", or
* ":endtry" or when the catch clause is left by a ":continue",
* ":break", ":return", ":finish", error, interrupt, or another
* exception. */
// It's mandatory that the current exception is stored in the cstack
// so that it can be discarded at the next ":catch", ":finally", or
// ":endtry" or when the catch clause is left by a ":continue",
// ":break", ":return", ":finish", error, interrupt, or another
// exception.
if (cstack->cs_exception[cstack->cs_idx] != current_exception) {
internal_error("ex_catch()");
}
@ -1576,13 +1571,13 @@ void ex_finally(exarg_T *eap)
assert(pending >= CHAR_MIN && pending <= CHAR_MAX);
cstack->cs_pending[cstack->cs_idx] = (char)pending;
/* It's mandatory that the current exception is stored in the
* cstack so that it can be rethrown at the ":endtry" or be
* discarded if the finally clause is left by a ":continue",
* ":break", ":return", ":finish", error, interrupt, or another
* exception. When emsg() is called for a missing ":endif" or
* a missing ":endwhile"/":endfor" detected here, the
* exception will be discarded. */
// It's mandatory that the current exception is stored in the
// cstack so that it can be rethrown at the ":endtry" or be
// discarded if the finally clause is left by a ":continue",
// ":break", ":return", ":finish", error, interrupt, or another
// exception. When emsg() is called for a missing ":endif" or
// a missing ":endwhile"/":endfor" detected here, the
// exception will be discarded.
if (current_exception
&& cstack->cs_exception[cstack->cs_idx] != current_exception) {
internal_error("ex_finally()");
@ -1666,21 +1661,20 @@ void ex_endtry(exarg_T *eap)
}
}
/* If there was no finally clause, show the user when debugging or
* a breakpoint was encountered that the end of the try conditional has
* been reached: display the debug prompt (if not already done). Do
* this on normal control flow or when an exception was thrown, but not
* on an interrupt or error not converted to an exception or when
* a ":break", ":continue", ":return", or ":finish" is pending. These
* actions are carried out immediately.
*/
// If there was no finally clause, show the user when debugging or
// a breakpoint was encountered that the end of the try conditional has
// been reached: display the debug prompt (if not already done). Do
// this on normal control flow or when an exception was thrown, but not
// on an interrupt or error not converted to an exception or when
// a ":break", ":continue", ":return", or ":finish" is pending. These
// actions are carried out immediately.
if ((rethrow || (!skip
&& !(cstack->cs_flags[idx] & CSF_FINALLY)
&& !cstack->cs_pending[idx]))
&& dbg_check_skipped(eap)) {
/* Handle a ">quit" debug command as if an interrupt had occurred
* before the ":endtry". That is, throw an interrupt exception and
* set "skip" and "rethrow". */
// Handle a ">quit" debug command as if an interrupt had occurred
// before the ":endtry". That is, throw an interrupt exception and
// set "skip" and "rethrow".
if (got_int) {
skip = TRUE;
(void)do_intthrow(cstack);
@ -1815,13 +1809,12 @@ void enter_cleanup(cleanup_T *csp)
| (current_exception ? CSTP_THROW : 0)
| (need_rethrow ? CSTP_THROW : 0);
/* If we are currently throwing an exception, save it as well. On an error
* not yet converted to an exception, update "force_abort" and reset
* "cause_abort" (as do_errthrow() would do). This is needed for the
* do_cmdline() call that is going to be made for autocommand execution. We
* need not save *msg_list because there is an extra instance for every call
* of do_cmdline(), anyway.
*/
// If we are currently throwing an exception, save it as well. On an error
// not yet converted to an exception, update "force_abort" and reset
// "cause_abort" (as do_errthrow() would do). This is needed for the
// do_cmdline() call that is going to be made for autocommand execution. We
// need not save *msg_list because there is an extra instance for every call
// of do_cmdline(), anyway.
if (current_exception || need_rethrow) {
csp->exception = current_exception;
current_exception = NULL;
@ -1897,13 +1890,10 @@ void leave_cleanup(cleanup_T *csp)
*/
if (pending & CSTP_THROW) {
current_exception = csp->exception;
}
/*
* If an error was about to be converted to an exception when
* enter_cleanup() was called, let "cause_abort" take the part of
* "force_abort" (as done by cause_errthrow()).
*/
else if (pending & CSTP_ERROR) {
} else if (pending & CSTP_ERROR) {
// If an error was about to be converted to an exception when
// enter_cleanup() was called, let "cause_abort" take the part of
// "force_abort" (as done by cause_errthrow()).
cause_abort = force_abort;
force_abort = FALSE;
}

View File

@ -2625,8 +2625,8 @@ static void realloc_cmdbuff(int len)
char_u *p = ccline.cmdbuff;
alloc_cmdbuff(len); // will get some more
/* There isn't always a NUL after the command, but it may need to be
* there, thus copy up to the NUL and add a NUL. */
// There isn't always a NUL after the command, but it may need to be
// there, thus copy up to the NUL and add a NUL.
memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen);
ccline.cmdbuff[ccline.cmdlen] = NUL;
xfree(p);
@ -3427,24 +3427,24 @@ static bool cmdline_paste(int regname, bool literally, bool remcr)
bool allocated;
struct cmdline_info save_ccline;
/* check for valid regname; also accept special characters for CTRL-R in
* the command line */
// check for valid regname; also accept special characters for CTRL-R in
// the command line
if (regname != Ctrl_F && regname != Ctrl_P && regname != Ctrl_W
&& regname != Ctrl_A && regname != Ctrl_L
&& !valid_yank_reg(regname, false)) {
return FAIL;
}
/* A register containing CTRL-R can cause an endless loop. Allow using
* CTRL-C to break the loop. */
// A register containing CTRL-R can cause an endless loop. Allow using
// CTRL-C to break the loop.
line_breakcheck();
if (got_int) {
return FAIL;
}
/* Need to save and restore ccline. And set "textlock" to avoid nasty
* things like going to another buffer when evaluating an expression. */
// Need to save and restore ccline. And set "textlock" to avoid nasty
// things like going to another buffer when evaluating an expression.
save_cmdline(&save_ccline);
textlock++;
const bool i = get_spec_reg(regname, &arg, &allocated, true);
@ -6411,8 +6411,8 @@ static int open_cmdwin(void)
}
}
/* Replace the empty last line with the current command-line and put the
* cursor there. */
// Replace the empty last line with the current command-line and put the
// cursor there.
ml_replace(curbuf->b_ml.ml_line_count, ccline.cmdbuff, true);
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
curwin->w_cursor.col = ccline.cmdpos;

View File

@ -224,8 +224,8 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
bool keep_dest_enc = false; // don't retry when char doesn't fit
// in destination encoding
int bad_char_behavior = BAD_REPLACE;
/* BAD_KEEP, BAD_DROP or character to
* replace with */
// BAD_KEEP, BAD_DROP or character to
// replace with
char_u *tmpname = NULL; // name of 'charconvert' output file
int fio_flags = 0;
char_u *fenc; // fileencoding to use
@ -280,8 +280,8 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
|| (sfname == curbuf->b_ffname);
using_b_fname = (fname == curbuf->b_fname) || (sfname == curbuf->b_fname);
/* After reading a file the cursor line changes but we don't want to
* display the line. */
// After reading a file the cursor line changes but we don't want to
// display the line.
ex_no_reprint = true;
// don't display the file info for another buffer now
@ -454,9 +454,9 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
// been created by someone else, a ":w" will complain.
curbuf->b_flags |= BF_NEW;
/* Create a swap file now, so that other Vims are warned
* that we are editing this file. Don't do this for a
* "nofile" or "nowrite" buffer type. */
// Create a swap file now, so that other Vims are warned
// that we are editing this file. Don't do this for a
// "nofile" or "nowrite" buffer type.
if (!bt_dontwrite(curbuf)) {
check_need_swap(newfile);
// SwapExists autocommand may mess things up
@ -524,9 +524,9 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
curbuf->b_start_bomb = FALSE;
}
/* Create a swap file now, so that other Vims are warned that we are
* editing this file.
* Don't do this for a "nofile" or "nowrite" buffer type. */
// Create a swap file now, so that other Vims are warned that we are
// editing this file.
// Don't do this for a "nofile" or "nowrite" buffer type.
if (!bt_dontwrite(curbuf)) {
check_need_swap(newfile);
if (!read_stdin
@ -854,8 +854,8 @@ retry:
#ifdef HAVE_ICONV
did_iconv = false;
#endif
/* Skip conversion when it's already done (retry for wrong
* "fileformat"). */
// Skip conversion when it's already done (retry for wrong
// "fileformat").
if (tmpname == NULL) {
tmpname = readfile_charconvert(fname, fenc, &fd);
if (tmpname == NULL) {
@ -876,17 +876,17 @@ retry:
&& iconv_fd == (iconv_t)-1
#endif
) {
/* Conversion wanted but we can't.
* Try the next conversion in 'fileencodings' */
// Conversion wanted but we can't.
// Try the next conversion in 'fileencodings'
advance_fenc = true;
goto retry;
}
}
}
/* Set "can_retry" when it's possible to rewind the file and try with
* another "fenc" value. It's FALSE when no other "fenc" to try, reading
* stdin or fixed at a specific encoding. */
// Set "can_retry" when it's possible to rewind the file and try with
// another "fenc" value. It's FALSE when no other "fenc" to try, reading
// stdin or fixed at a specific encoding.
can_retry = (*fenc != NUL && !read_stdin && !keep_dest_enc && !read_fifo);
if (!skip_read) {
@ -1014,9 +1014,9 @@ retry:
read_buf_col += n;
break;
} else {
/* Append whole line and new-line. Change NL
* to NUL to reverse the effect done below. */
for (ni = 0; ni < n; ++ni) {
// Append whole line and new-line. Change NL
// to NUL to reverse the effect done below.
for (ni = 0; ni < n; ni++) {
if (p[ni] == NL) {
ptr[tlen++] = NUL;
} else {
@ -1076,10 +1076,10 @@ retry:
*(ptr - conv_restlen) = NUL;
conv_restlen = 0;
} else {
/* Replace the trailing bytes with the replacement
* character if we were converting; if we weren't,
* leave the UTF8 checking code to do it, as it
* works slightly differently. */
// Replace the trailing bytes with the replacement
// character if we were converting; if we weren't,
// leave the UTF8 checking code to do it, as it
// works slightly differently.
if (bad_char_behavior != BAD_KEEP && (fio_flags != 0
#ifdef HAVE_ICONV
|| iconv_fd != (iconv_t)-1
@ -1212,8 +1212,8 @@ retry:
}
if (from_size > 0) {
/* Some remaining characters, keep them for the next
* round. */
// Some remaining characters, keep them for the next
// round.
memmove(conv_rest, (char_u *)fromp, from_size);
conv_restlen = (int)from_size;
}
@ -1752,11 +1752,11 @@ failed:
}
if (newfile || read_buffer) {
redraw_curbuf_later(NOT_VALID);
/* After reading the text into the buffer the diff info needs to
* be updated. */
// After reading the text into the buffer the diff info needs to
// be updated.
diff_invalidate(curbuf);
/* All folds in the window are invalid now. Mark them for update
* before triggering autocommands. */
// All folds in the window are invalid now. Mark them for update
// before triggering autocommands.
foldUpdateAll(curwin);
} else if (linecnt) { // appended at least one line
appended_lines_mark(from, linecnt);
@ -2129,8 +2129,8 @@ static char_u *readfile_charconvert(char_u *fname, char_u *fenc, int *fdp)
}
if (errmsg != NULL) {
/* Don't use emsg(), it breaks mappings, the retry with
* another type of conversion might still work. */
// Don't use emsg(), it breaks mappings, the retry with
// another type of conversion might still work.
MSG(errmsg);
if (tmpname != NULL) {
os_remove((char *)tmpname); // delete converted file
@ -3908,9 +3908,9 @@ static int check_mtime(buf_T *buf, FileInfo *file_info)
static bool time_differs(long t1, long t2) FUNC_ATTR_CONST
{
#if defined(__linux__) || defined(MSWIN)
/* On a FAT filesystem, esp. under Linux, there are only 5 bits to store
* the seconds. Since the roundoff is done when flushing the inode, the
* time may change unexpectedly by one second!!! */
// On a FAT filesystem, esp. under Linux, there are only 5 bits to store
// the seconds. Since the roundoff is done when flushing the inode, the
// time may change unexpectedly by one second!!!
return t1 - t2 > 1 || t2 - t1 > 1;
#else
return t1 != t2;
@ -4192,8 +4192,8 @@ static bool need_conversion(const char_u *fenc)
same_encoding = TRUE;
fenc_flags = 0;
} else {
/* Ignore difference between "ansi" and "latin1", "ucs-4" and
* "ucs-4be", etc. */
// Ignore difference between "ansi" and "latin1", "ucs-4" and
// "ucs-4be", etc.
enc_flags = get_fio_flags(p_enc);
fenc_flags = get_fio_flags(fenc);
same_encoding = (enc_flags != 0 && fenc_flags == enc_flags);
@ -4203,8 +4203,8 @@ static bool need_conversion(const char_u *fenc)
return false;
}
/* Encodings differ. However, conversion is not needed when 'enc' is any
* Unicode encoding and the file is UTF-8. */
// Encodings differ. However, conversion is not needed when 'enc' is any
// Unicode encoding and the file is UTF-8.
return !(fenc_flags == FIO_UTF8);
}
@ -4697,8 +4697,8 @@ int vim_rename(const char_u *from, const char_u *to)
(void)os_rename(tempname, from);
return -1;
}
/* If it fails for one temp name it will most likely fail
* for any temp name, give up. */
// If it fails for one temp name it will most likely fail
// for any temp name, give up.
return -1;
}
}
@ -4954,8 +4954,8 @@ int buf_check_timestamp(buf_T *buf)
buf_store_file_info(buf, &file_info);
}
/* Don't do anything for a directory. Might contain the file
* explorer. */
// Don't do anything for a directory. Might contain the file
// explorer.
if (os_isdir(buf->b_fname)) {
} else if ((buf->b_p_ar >= 0 ? buf->b_p_ar : p_ar)
&& !bufIsChanged(buf) && file_info_ok) {
@ -5217,8 +5217,8 @@ void buf_reload(buf_T *buf, int orig_mode)
// Invalidate diff info if necessary.
diff_invalidate(curbuf);
/* Restore the topline and cursor position and check it (lines may
* have been removed). */
// Restore the topline and cursor position and check it (lines may
// have been removed).
if (old_topline > curbuf->b_ml.ml_line_count) {
curwin->w_topline = curbuf->b_ml.ml_line_count;
} else {
@ -5237,9 +5237,9 @@ void buf_reload(buf_T *buf, int orig_mode)
}
}
/* If the mode didn't change and 'readonly' was set, keep the old
* value; the user probably used the ":view" command. But don't
* reset it, might have had a read error. */
// If the mode didn't change and 'readonly' was set, keep the old
// value; the user probably used the ":view" command. But don't
// reset it, might have had a read error.
if (orig_mode == curbuf->b_orig_mode) {
curbuf->b_p_ro |= old_ro;
}
@ -5754,8 +5754,8 @@ long write_eintr(int fd, void *buf, size_t bufsize)
long ret = 0;
long wlen;
/* Repeat the write() so long it didn't fail, other than being interrupted
* by a signal. */
// Repeat the write() so long it didn't fail, other than being interrupted
// by a signal.
while (ret < (long)bufsize) {
wlen = write(fd, (char *)buf + ret, bufsize - ret);
if (wlen < 0) {

View File

@ -72,12 +72,12 @@ typedef struct {
linenr_T lnum_save; // line nr used by foldUpdateIEMSRecurse()
int lvl; // current level (-1 for undefined)
int lvl_next; // level used for next line
int start; /* number of folds that are forced to start at
this line. */
int end; /* level of fold that is forced to end below
this line */
int had_end; /* level of fold that is forced to end above
this line (copy of "end" of prev. line) */
int start; // number of folds that are forced to start at
// this line.
int end; // level of fold that is forced to end below
// this line
int had_end; // level of fold that is forced to end above
// this line (copy of "end" of prev. line)
} fline_T;
// Flag is set when redrawing is needed.
@ -405,8 +405,8 @@ void opFoldRange(pos_T firstpos, pos_T lastpos, int opening, int recurse, int ha
for (lnum = first; lnum <= last; lnum = lnum_next + 1) {
pos_T temp = { lnum, 0, 0 };
lnum_next = lnum;
/* Opening one level only: next fold to open is after the one going to
* be opened. */
// Opening one level only: next fold to open is after the one going to
// be opened.
if (opening && !recurse) {
(void)hasFolding(lnum, NULL, &lnum_next);
}
@ -639,8 +639,8 @@ void foldCreate(win_T *wp, pos_T start, pos_T end)
}
if (cont > 0) {
ga_grow(&fold_ga, cont);
/* If the first fold starts before the new fold, let the new fold
* start there. Otherwise the existing fold would change. */
// If the first fold starts before the new fold, let the new fold
// start there. Otherwise the existing fold would change.
if (start_rel.lnum > fp->fd_top) {
start_rel.lnum = fp->fd_top;
}
@ -655,8 +655,8 @@ void foldCreate(win_T *wp, pos_T start, pos_T end)
fold_ga.ga_len += cont;
i += cont;
/* Adjust line numbers in contained folds to be relative to the
* new fold. */
// Adjust line numbers in contained folds to be relative to the
// new fold.
for (int j = 0; j < cont; j++) {
((fold_T *)fold_ga.ga_data)[j].fd_top -= start_rel.lnum;
}
@ -673,9 +673,8 @@ void foldCreate(win_T *wp, pos_T start, pos_T end)
fp->fd_top = start_rel.lnum;
fp->fd_len = end_rel.lnum - start_rel.lnum + 1;
/* We want the new fold to be closed. If it would remain open because
* of using 'foldlevel', need to adjust fd_flags of containing folds.
*/
// We want the new fold to be closed. If it would remain open because
// of using 'foldlevel', need to adjust fd_flags of containing folds.
if (use_level && !closed && level < wp->w_p_fdl) {
closeFold(start, 1L);
}
@ -916,8 +915,8 @@ int foldMoveTo(const bool updown, const int dir, const long count)
break;
}
}
/* don't look for contained folds, they will always move
* the cursor too far. */
// don't look for contained folds, they will always move
// the cursor too far.
last = true;
}
@ -953,8 +952,8 @@ int foldMoveTo(const bool updown, const int dir, const long count)
}
}
} else {
/* Open fold found, set cursor to its start/end and then check
* nested folds. */
// Open fold found, set cursor to its start/end and then check
// nested folds.
if (dir == FORWARD) {
lnum = fp->fd_top + lnum_off + fp->fd_len - 1;
if (lnum > curwin->w_cursor.lnum) {
@ -1375,8 +1374,8 @@ static void deleteFoldEntry(win_T *const wp, garray_T *const gap, const int idx,
memmove(fp, fp + 1, sizeof(*fp) * (size_t)(gap->ga_len - idx));
}
} else {
/* Move nested folds one level up, to overwrite the fold that is
* deleted. */
// Move nested folds one level up, to overwrite the fold that is
// deleted.
int moved = fp->fd_nested.ga_len;
ga_grow(gap, moved - 1);
{
@ -1517,8 +1516,8 @@ static void foldMarkAdjustRecurse(win_T *wp, garray_T *gap, linenr_T line1, line
fp->fd_len += amount_after;
}
} else {
/* 5. fold is below line1 and contains line2; need to
* correct nested folds too */
// 5. fold is below line1 and contains line2; need to
// correct nested folds too
if (amount == MAXLNUM) {
foldMarkAdjustRecurse(wp, &fp->fd_nested, line1 - fp->fd_top,
line2 - fp->fd_top, amount,
@ -1660,8 +1659,8 @@ static void foldCreateMarkers(win_T *wp, pos_T start, pos_T end)
foldAddMarker(buf, start, wp->w_p_fmr, foldstartmarkerlen);
foldAddMarker(buf, end, foldendmarker, foldendmarkerlen);
/* Update both changes here, to avoid all folds after the start are
* changed when the start marker is inserted and the end isn't. */
// Update both changes here, to avoid all folds after the start are
// changed when the start marker is inserted and the end isn't.
// TODO(teto): pass the buffer
changed_lines(start.lnum, (colnr_T)0, end.lnum, 0L, false);
@ -1857,8 +1856,8 @@ char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldin
}
if (text != NULL) {
/* Replace unprintable characters, if there are any. But
* replace a TAB with a space. */
// Replace unprintable characters, if there are any. But
// replace a TAB with a space.
for (p = text; *p != NUL; p++) {
int len = utfc_ptr2len(p);
@ -1941,10 +1940,9 @@ void foldtext_cleanup(char_u *str)
++len;
}
/* May remove 'commentstring' start. Useful when it's a double
* quote and we already removed a double quote. */
for (p = s; p > str && ascii_iswhite(p[-1]); --p) {
;
// May remove 'commentstring' start. Useful when it's a double
// quote and we already removed a double quote.
for (p = s; p > str && ascii_iswhite(p[-1]); p--) {
}
if (p >= str + cms_slen
&& STRNCMP(p - cms_slen, cms_start, cms_slen) == 0) {
@ -2074,12 +2072,12 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
getlevel = foldlevelIndent;
}
/* Backup to a line for which the fold level is defined. Since it's
* always defined for line one, we will stop there. */
// Backup to a line for which the fold level is defined. Since it's
// always defined for line one, we will stop there.
fline.lvl = -1;
for (; !got_int; --fline.lnum) {
/* Reset lvl_next each time, because it will be set to a value for
* the next line, but we search backwards here. */
for (; !got_int; fline.lnum--) {
// Reset lvl_next each time, because it will be set to a value for
// the next line, but we search backwards here.
fline.lvl_next = -1;
getlevel(&fline);
if (fline.lvl >= 0) {
@ -2128,15 +2126,15 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
end = start;
}
while (!got_int) {
/* Always stop at the end of the file ("end" can be past the end of
* the file). */
// Always stop at the end of the file ("end" can be past the end of
// the file).
if (fline.lnum > wp->w_buffer->b_ml.ml_line_count) {
break;
}
if (fline.lnum > end) {
/* For "marker", "expr" and "syntax" methods: If a change caused
* a fold to be removed, we need to continue at least until where
* it ended. */
// For "marker", "expr" and "syntax" methods: If a change caused
// a fold to be removed, we need to continue at least until where
// it ended.
if (getlevel != foldlevelMarker
&& getlevel != foldlevelSyntax
&& getlevel != foldlevelExpr) {
@ -2334,17 +2332,17 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
* firstlnum.
*/
while (!got_int) {
/* set concat to 1 if it's allowed to concatenated this fold
* with a previous one that touches it. */
// set concat to 1 if it's allowed to concatenated this fold
// with a previous one that touches it.
if (flp->start != 0 || flp->had_end <= MAX_LEVEL) {
concat = 0;
} else {
concat = 1;
}
/* Find an existing fold to re-use. Preferably one that
* includes startlnum, otherwise one that ends just before
* startlnum or starts after it. */
// Find an existing fold to re-use. Preferably one that
// includes startlnum, otherwise one that ends just before
// startlnum or starts after it.
if (gap->ga_len > 0
&& (foldFind(gap, startlnum, &fp)
|| (fp < ((fold_T *)gap->ga_data) + gap->ga_len
@ -2405,9 +2403,9 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
i = (int)(fp - (fold_T *)gap->ga_data);
foldSplit(flp->wp->w_buffer, gap, i, breakstart, breakend - 1);
fp = (fold_T *)gap->ga_data + i + 1;
/* If using the "marker" or "syntax" method, we
* need to continue until the end of the fold is
* found. */
// If using the "marker" or "syntax" method, we
// need to continue until the end of the fold is
// found.
if (getlevel == foldlevelMarker
|| getlevel == foldlevelExpr
|| getlevel == foldlevelSyntax) {
@ -2433,8 +2431,8 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
deleteFoldEntry(flp->wp, gap,
(int)(fp - (fold_T *)gap->ga_data), true);
} else {
/* A fold has some lines above startlnum, truncate it
* to stop just above startlnum. */
// A fold has some lines above startlnum, truncate it
// to stop just above startlnum.
fp->fd_len = startlnum - fp->fd_top;
foldMarkAdjustRecurse(flp->wp, &fp->fd_nested,
fp->fd_len, (linenr_T)MAXLNUM,
@ -2442,8 +2440,8 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
fold_changed = true;
}
} else {
/* Insert new fold. Careful: ga_data may be NULL and it
* may change! */
// Insert new fold. Careful: ga_data may be NULL and it
// may change!
if (gap->ga_len == 0) {
i = 0;
} else {
@ -2451,13 +2449,13 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
}
foldInsert(gap, i);
fp = (fold_T *)gap->ga_data + i;
/* The new fold continues until bot, unless we find the
* end earlier. */
// The new fold continues until bot, unless we find the
// end earlier.
fp->fd_top = firstlnum;
fp->fd_len = bot - firstlnum + 1;
/* When the containing fold is open, the new fold is open.
* The new fold is closed if the fold above it is closed.
* The first fold depends on the containing fold. */
// When the containing fold is open, the new fold is open.
// The new fold is closed if the fold above it is closed.
// The first fold depends on the containing fold.
if (topflags == FD_OPEN) {
flp->wp->w_fold_manual = true;
fp->fd_flags = FD_OPEN;
@ -2684,8 +2682,8 @@ static void foldSplit(buf_T *buf, garray_T *const gap, const int i, const linenr
fp[1].fd_small = kNone;
fp->fd_small = kNone;
/* Move nested folds below bot to new fold. There can't be
* any between top and bot, they have been removed by the caller. */
// Move nested folds below bot to new fold. There can't be
// any between top and bot, they have been removed by the caller.
garray_T *const gap1 = &fp->fd_nested;
garray_T *const gap2 = &fp[1].fd_nested;
if (foldFind(gap1, bot + 1 - fp->fd_top, &fp2)) {
@ -3039,8 +3037,8 @@ static void foldlevelExpr(fline_T *flp)
flp->lvl = 0;
}
/* KeyTyped may be reset to 0 when calling a function which invokes
* do_cmdline(). To make 'foldopen' work correctly restore KeyTyped. */
// KeyTyped may be reset to 0 when calling a function which invokes
// do_cmdline(). To make 'foldopen' work correctly restore KeyTyped.
const bool save_keytyped = KeyTyped;
const int n = eval_foldexpr(flp->wp->w_p_fde, &c);
KeyTyped = save_keytyped;
@ -3308,9 +3306,9 @@ static int put_foldopen_recurse(FILE *fd, win_T *wp, garray_T *gap, linenr_T off
}
}
} else {
/* Open or close the leaf according to the window foldlevel.
* Do not close a leaf that is already closed, as it will close
* the parent. */
// Open or close the leaf according to the window foldlevel.
// Do not close a leaf that is already closed, as it will close
// the parent.
level = foldLevelWin(wp, off + fp->fd_top);
if ((fp->fd_flags == FD_CLOSED && wp->w_p_fdl >= level)
|| (fp->fd_flags != FD_CLOSED && wp->w_p_fdl < level)) {