aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-10-23 13:05:19 -0400
committerGitHub <noreply@github.com>2021-10-23 13:05:19 -0400
commitbb9e6a15834dcab2cb58afe22fedd0a4d818d9a8 (patch)
tree0367fad361ebed9832d7d9bd9018dff1a670dc39 /src
parentfa4b24072e13dc7303e896701f0bb6d0227caf0c (diff)
parente59c0009a76cee92bedf72fbd1db04e4a16ed24b (diff)
downloadrneovim-bb9e6a15834dcab2cb58afe22fedd0a4d818d9a8.tar.gz
rneovim-bb9e6a15834dcab2cb58afe22fedd0a4d818d9a8.tar.bz2
rneovim-bb9e6a15834dcab2cb58afe22fedd0a4d818d9a8.zip
Merge pull request #16111 from dundargoc/vim-patch/comments
vim-patch:8.1.2368,8.1.2378,8.1.2379,8.1.2380,8.1.2387,8.1.2388,8.1.2392,8.1.2394,8.1.2395,8.1.2396
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c44
-rw-r--r--src/nvim/edit.c8
-rw-r--r--src/nvim/eval.c34
-rw-r--r--src/nvim/eval/userfunc.c32
-rw-r--r--src/nvim/ex_cmds.c128
-rw-r--r--src/nvim/ex_docmd.c87
-rw-r--r--src/nvim/ex_eval.c160
-rw-r--r--src/nvim/ex_getln.c20
-rw-r--r--src/nvim/fileio.c100
-rw-r--r--src/nvim/fold.c128
-rw-r--r--src/nvim/getchar.c43
-rw-r--r--src/nvim/hardcopy.c131
-rw-r--r--src/nvim/main.c10
-rw-r--r--src/nvim/mbyte.c28
-rw-r--r--src/nvim/memline.c24
-rw-r--r--src/nvim/menu.c28
-rw-r--r--src/nvim/normal.c106
-rw-r--r--src/nvim/ops.c74
-rw-r--r--src/nvim/option.c54
-rw-r--r--src/nvim/regexp.c52
-rw-r--r--src/nvim/regexp_nfa.c191
-rw-r--r--src/nvim/screen.c22
-rw-r--r--src/nvim/search.c107
-rw-r--r--src/nvim/syntax.c68
-rw-r--r--src/nvim/tag.c70
-rw-r--r--src/nvim/undo.c68
-rw-r--r--src/nvim/window.c88
27 files changed, 934 insertions, 971 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 0cc5dda018..3ad93c1c2c 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -308,8 +308,8 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags)
curbuf->b_flags |= BF_READERR;
}
- /* Need to update automatic folding. Do this before the autocommands,
- * they may use the fold info. */
+ // Need to update automatic folding. Do this before the autocommands,
+ // they may use the fold info.
foldUpdateAll(curwin);
// need to set w_topline, unless some autocommand already did that.
@@ -863,8 +863,8 @@ void goto_buffer(exarg_T *eap, int start, int dir, int count)
swap_exists_action = SEA_NONE;
swap_exists_did_quit = true;
- /* 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 {
handle_swap_exists(&old_curbuf);
@@ -919,8 +919,8 @@ void handle_swap_exists(bufref_T *old_curbuf)
}
// If "old_curbuf" is NULL we are in big trouble here...
- /* 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 (swap_exists_action == SEA_RECOVER) {
// Reset the error/interrupt/exception state here so that
@@ -934,8 +934,8 @@ void handle_swap_exists(bufref_T *old_curbuf)
cmdline_row = msg_row;
do_modelines(0);
- /* 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);
}
swap_exists_action = SEA_NONE; // -V519
@@ -1152,8 +1152,8 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
} else {
bp = NULL;
while (count > 0 || (!unload && !buf->b_p_bl && bp != buf)) {
- /* remember the buffer where we start, we come back there when all
- * buffers are unlisted. */
+ // remember the buffer where we start, we come back there when all
+ // buffers are unlisted.
if (bp == NULL) {
bp = buf;
}
@@ -1204,8 +1204,8 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
bufref_T bufref;
set_bufref(&bufref, buf);
- /* When unloading or deleting a buffer that's already unloaded and
- * unlisted: fail silently. */
+ // When unloading or deleting a buffer that's already unloaded and
+ // unlisted: fail silently.
if (action != DOBUF_WIPE && buf->b_ml.ml_mfp == NULL && !buf->b_p_bl) {
return FAIL;
}
@@ -1385,8 +1385,8 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
}
if (buf == NULL) {
- /* Autocommands must have wiped out all other buffers. Only option
- * now is to make the current buffer empty. */
+ // Autocommands must have wiped out all other buffers. Only option
+ // now is to make the current buffer empty.
return empty_curbuf(false, forceit, action);
}
@@ -1509,9 +1509,9 @@ void set_curbuf(buf_T *buf, int action)
}
}
}
- /* An autocommand may have deleted "buf", already entered it (e.g., when
- * it did ":bunload") or aborted the script processing!
- * If curwin->w_buffer is null, enter_buffer() will make it valid again */
+ // An autocommand may have deleted "buf", already entered it (e.g., when
+ // it did ":bunload") or aborted the script processing!
+ // If curwin->w_buffer is null, enter_buffer() will make it valid again
if ((buf_valid(buf) && buf != curbuf
&& !aborting()
) || curwin->w_buffer == NULL) {
@@ -2226,8 +2226,8 @@ int buflist_findpat(const char_u *pattern, const char_u *pattern_end, bool unlis
&& (!diffmode || diff_mode_buf(buf))
&& buflist_match(&regmatch, buf, false) != NULL) {
if (curtab_only) {
- /* Ignore the match if the buffer is not open in
- * the current tab. */
+ // Ignore the match if the buffer is not open in
+ // the current tab.
bool found_window = false;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp->w_buffer == buf) {
@@ -5159,9 +5159,9 @@ void ex_buffer_all(exarg_T *eap)
swap_exists_action = SEA_NONE;
swap_exists_did_quit = true;
- /* 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 {
handle_swap_exists(NULL);
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index b3a08971e9..0cfda53091 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -523,7 +523,7 @@ static int insert_check(VimState *state)
did_cursorhold = false;
}
- // If the cursor was moved we didn't just insert a space */
+ // If the cursor was moved we didn't just insert a space
if (arrow_used) {
s->inserted_space = false;
}
@@ -835,7 +835,7 @@ static int insert_handle_key(InsertState *s)
case Ctrl_C: // End input mode
if (s->c == Ctrl_C && cmdwin_type != 0) {
- // Close the cmdline window. */
+ // Close the cmdline window.
cmdwin_result = K_IGNORE;
got_int = false; // don't stop executing autocommands et al
s->nomove = true;
@@ -6346,8 +6346,8 @@ void auto_format(bool trailblank, bool prev_line)
curwin->w_cursor = pos;
}
- /* With the 'c' flag in 'formatoptions' and 't' missing: only format
- * comments. */
+ // With the 'c' flag in 'formatoptions' and 't' missing: only format
+ // comments.
if (has_format_option(FO_WRAP_COMS) && !has_format_option(FO_WRAP)
&& get_leader_len(old, NULL, false, true) == 0) {
return;
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index e6a3901dcf..b31e1e81d4 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -2026,9 +2026,9 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
p);
lp->ll_name = lp->ll_exp_name;
if (lp->ll_exp_name == NULL) {
- /* Report an invalid expression in braces, unless the
- * expression evaluation has been cancelled due to an
- * aborting error, an interrupt, or an exception. */
+ // Report an invalid expression in braces, unless the
+ // expression evaluation has been cancelled due to an
+ // aborting error, an interrupt, or an exception.
if (!aborting() && !quiet) {
emsg_severe = true;
EMSG2(_(e_invarg2), name);
@@ -2173,9 +2173,9 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
lp->ll_dict = lp->ll_tv->vval.v_dict;
lp->ll_di = tv_dict_find(lp->ll_dict, (const char *)key, len);
- /* When assigning to a scope dictionary check that a function and
- * variable name is valid (only variable name unless it is l: or
- * g: dictionary). Disallow overwriting a builtin function. */
+ // When assigning to a scope dictionary check that a function and
+ // variable name is valid (only variable name unless it is l: or
+ // g: dictionary). Disallow overwriting a builtin function.
if (rettv != NULL && lp->ll_dict->dv_scope != 0) {
int prevval;
int wrong;
@@ -2758,8 +2758,8 @@ void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
xp->xp_context = EXPAND_EXPRESSION;
}
} else {
- /* Doesn't look like something valid, expand as an expression
- * anyway. */
+ // Doesn't look like something valid, expand as an expression
+ // anyway.
xp->xp_context = EXPAND_EXPRESSION;
}
arg = xp->xp_pattern;
@@ -4927,9 +4927,9 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
++p;
nr = (nr << 4) + hex2nr(*p);
}
- ++p;
- /* For "\u" store the number according to
- * 'encoding'. */
+ p++;
+ // For "\u" store the number according to
+ // 'encoding'.
if (c != 'X') {
name += utf_char2bytes(nr, name);
} else {
@@ -8452,7 +8452,7 @@ const char_u *find_name_end(const char_u *arg, const char_u **expr_start, const
}
} else if (br_nest == 0 && mb_nest == 0 && *p == ':') {
// "s:" is start of "s:var", but "n:" is not and can be used in
- // slice "[n:]". Also "xx:" is not a namespace. But {ns}: is. */
+ // slice "[n:]". Also "xx:" is not a namespace. But {ns}: is.
len = (int)(p - arg);
if ((len > 1 && p[-1] != '}')
|| (len == 1 && vim_strchr(namespace_char, *arg) == NULL)) {
@@ -9825,12 +9825,12 @@ void ex_echo(exarg_T *eap)
if (!eap->skip) {
if (atstart) {
atstart = false;
- /* Call msg_start() after eval1(), evaluating the expression
- * may cause a message to appear. */
+ // Call msg_start() after eval1(), evaluating the expression
+ // may cause a message to appear.
if (eap->cmdidx == CMD_echo) {
- /* Mark the saved text as finishing the line, so that what
- * follows is displayed on a new line when scrolling back
- * at the more prompt. */
+ // Mark the saved text as finishing the line, so that what
+ // follows is displayed on a new line when scrolling back
+ // at the more prompt.
msg_sb_eol();
msg_start();
}
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index f4393a79dc..3c7532df7b 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -1720,8 +1720,8 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
return (char_u *)xmemdupz(start, len);
}
- /* A name starting with "<SID>" or "<SNR>" is local to a script. But
- * don't skip over "s:", get_lval() needs it for "s:dict.func". */
+ // A name starting with "<SID>" or "<SNR>" is local to a script. But
+ // don't skip over "s:", get_lval() needs it for "s:dict.func".
lead = eval_fname_script((const char *)start);
if (lead > 2) {
start += lead;
@@ -2405,14 +2405,14 @@ void ex_function(exarg_T *eap)
// Add the line to the function.
ga_grow(&newlines, 1 + sourcing_lnum_off);
- /* Copy the line to newly allocated memory. get_one_sourceline()
- * allocates 250 bytes per line, this saves 80% on average. The cost
- * is an extra alloc/free. */
+ // Copy the line to newly allocated memory. get_one_sourceline()
+ // allocates 250 bytes per line, this saves 80% on average. The cost
+ // is an extra alloc/free.
p = vim_strsave(theline);
((char_u **)(newlines.ga_data))[newlines.ga_len++] = p;
- /* Add NULL lines for continuation lines, so that the line count is
- * equal to the index in the growarray. */
+ // Add NULL lines for continuation lines, so that the line count is
+ // equal to the index in the growarray.
while (sourcing_lnum_off-- > 0) {
((char_u **)(newlines.ga_data))[newlines.ga_len++] = NULL;
}
@@ -2490,8 +2490,8 @@ void ex_function(exarg_T *eap)
goto erret;
}
- /* Give the function a sequential number. Can only be used with a
- * Funcref! */
+ // Give the function a sequential number. Can only be used with a
+ // Funcref!
xfree(name);
sprintf(numbuf, "%d", ++func_nr);
name = vim_strsave((char_u *)numbuf);
@@ -3079,13 +3079,13 @@ int do_return(exarg_T *eap, int reanimate, int is_cmd, void *rettv)
cstack->cs_pending[idx] = CSTP_RETURN;
if (!is_cmd && !reanimate) {
- /* A pending return again gets pending. "rettv" points to an
- * allocated variable with the rettv of the original ":return"'s
- * argument if present or is NULL else. */
+ // A pending return again gets pending. "rettv" points to an
+ // allocated variable with the rettv of the original ":return"'s
+ // argument if present or is NULL else.
cstack->cs_rettv[idx] = rettv;
} else {
- /* When undoing a return in order to make it pending, get the stored
- * return rettv. */
+ // When undoing a return in order to make it pending, get the stored
+ // return rettv.
if (reanimate) {
assert(current_funccal->rettv);
rettv = current_funccal->rettv;
@@ -3214,8 +3214,8 @@ int func_has_ended(void *cookie)
{
funccall_T *fcp = (funccall_T *)cookie;
- /* Ignore the "abort" flag if the abortion behavior has been changed due to
- * an error inside a try conditional. */
+ // Ignore the "abort" flag if the abortion behavior has been changed due to
+ // an error inside a try conditional.
return ((fcp->func->uf_flags & FC_ABORT) && did_emsg && !aborted_in_try())
|| fcp->returned;
}
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 4a23f284cc..36f8782fd7 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -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++) {
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 68dd4a22ff..532f8aa9b3 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -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