patch 8.1.2368: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
diff --git a/src/buffer.c b/src/buffer.c
index 3b50c89..4868428 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -78,9 +78,9 @@
*/
static int
read_buffer(
- int read_stdin, /* read file from stdin, otherwise fifo */
- exarg_T *eap, /* for forced 'ff' and 'fenc' or NULL */
- int flags) /* extra flags for readfile() */
+ int read_stdin, // read file from stdin, otherwise fifo
+ exarg_T *eap, // for forced 'ff' and 'fenc' or NULL
+ int flags) // extra flags for readfile()
{
int retval = OK;
linenr_T line_count;
@@ -98,24 +98,24 @@
flags | READ_BUFFER);
if (retval == OK)
{
- /* Delete the binary lines. */
+ // Delete the binary lines.
while (--line_count >= 0)
ml_delete((linenr_T)1, FALSE);
}
else
{
- /* Delete the converted lines. */
+ // Delete the converted lines.
while (curbuf->b_ml.ml_line_count > line_count)
ml_delete(line_count, FALSE);
}
- /* Put the cursor on the first line. */
+ // Put the cursor on the first line.
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
if (read_stdin)
{
- /* Set or reset 'modified' before executing autocommands, so that
- * it can be changed there. */
+ // Set or reset 'modified' before executing autocommands, so that
+ // it can be changed there.
if (!readonlymode && !BUFEMPTY())
changed();
else if (retval == OK)
@@ -158,9 +158,9 @@
*/
int
open_buffer(
- int read_stdin, /* read file from stdin */
- exarg_T *eap, /* for forced 'ff' and 'fenc' or NULL */
- int flags) /* extra flags for readfile() */
+ int read_stdin, // read file from stdin
+ exarg_T *eap, // for forced 'ff' and 'fenc' or NULL
+ int flags) // extra flags for readfile()
{
int retval = OK;
bufref_T old_curbuf;
@@ -211,12 +211,12 @@
return FAIL;
}
- /* The autocommands in readfile() may change the buffer, but only AFTER
- * reading the file. */
+ // The autocommands in readfile() may change the buffer, but only AFTER
+ // reading the file.
set_bufref(&old_curbuf, curbuf);
modified_was_set = FALSE;
- /* mark cursor position as being invalid */
+ // mark cursor position as being invalid
curwin->w_valid = 0;
if (curbuf->b_ffname != NULL
@@ -264,7 +264,7 @@
#ifdef FEAT_NETBEANS_INTG
netbeansFireChanges = oldFire;
#endif
- /* Help buffer is filtered. */
+ // Help buffer is filtered.
if (bt_help(curbuf))
fix_help_buffer();
}
@@ -287,7 +287,7 @@
retval = read_buffer(TRUE, eap, flags);
}
- /* if first time loading this buffer, init b_chartab[] */
+ // if first time loading this buffer, init b_chartab[]
if (curbuf->b_flags & BF_NEVERLOADED)
{
(void)buf_init_chartab(curbuf, FALSE);
@@ -301,11 +301,11 @@
* Apply the automatic commands, before processing the modelines.
* So the modelines have priority over autocommands.
*/
- /* When reading stdin, the buffer contents always needs writing, so set
- * the changed flag. Unless in readonly mode: "ls | gview -".
- * When interrupted and 'cpoptions' contains 'i' set changed flag. */
+ // When reading stdin, the buffer contents always needs writing, so set
+ // the changed flag. Unless in readonly mode: "ls | gview -".
+ // When interrupted and 'cpoptions' contains 'i' set changed flag.
if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
- || modified_was_set /* ":set modified" used in autocmd */
+ || modified_was_set // ":set modified" used in autocmd
#ifdef FEAT_EVAL
|| (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
#endif
@@ -313,14 +313,14 @@
changed();
else if (retval == OK && !read_stdin && !read_fifo)
unchanged(curbuf, FALSE, TRUE);
- save_file_ff(curbuf); /* keep this fileformat */
+ save_file_ff(curbuf); // keep this fileformat
- /* Set last_changedtick to avoid triggering a TextChanged autocommand right
- * after it was added. */
+ // Set last_changedtick to avoid triggering a TextChanged autocommand right
+ // after it was added.
curbuf->b_last_changedtick = CHANGEDTICK(curbuf);
curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf);
- /* require "!" to overwrite the file, because it wasn't read completely */
+ // require "!" to overwrite the file, because it wasn't read completely
#ifdef FEAT_EVAL
if (aborting())
#else
@@ -329,12 +329,12 @@
curbuf->b_flags |= BF_READERR;
#ifdef FEAT_FOLDING
- /* 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);
#endif
- /* need to set w_topline, unless some autocommand already did that. */
+ // need to set w_topline, unless some autocommand already did that.
if (!(curwin->w_valid & VALID_TOPLINE))
{
curwin->w_topline = 1;
@@ -358,7 +358,7 @@
{
aco_save_T aco;
- /* Go to the buffer that was opened. */
+ // Go to the buffer that was opened.
aucmd_prepbuf(&aco, old_curbuf.br_buf);
do_modelines(0);
curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED);
@@ -370,7 +370,7 @@
apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf);
#endif
- /* restore curwin/curbuf and a few other things */
+ // restore curwin/curbuf and a few other things
aucmd_restbuf(&aco);
}
}
@@ -413,8 +413,8 @@
{
buf_T *bp;
- /* Assume that we more often have a recent buffer, start with the last
- * one. */
+ // Assume that we more often have a recent buffer, start with the last
+ // one.
for (bp = lastbuf; bp != NULL; bp = bp->b_prev)
if (bp == buf)
return TRUE;
@@ -490,7 +490,7 @@
*/
void
close_buffer(
- win_T *win, /* if not NULL, set b_last_cursor */
+ win_T *win, // if not NULL, set b_last_cursor
buf_T *buf,
int action,
int abort_if_last)
@@ -510,18 +510,18 @@
* The caller must take care of NOT deleting/freeing when 'bufhidden' is
* "hide" (otherwise we could never free or delete a buffer).
*/
- if (buf->b_p_bh[0] == 'd') /* 'bufhidden' == "delete" */
+ if (buf->b_p_bh[0] == 'd') // 'bufhidden' == "delete"
{
del_buf = TRUE;
unload_buf = TRUE;
}
- else if (buf->b_p_bh[0] == 'w') /* 'bufhidden' == "wipe" */
+ else if (buf->b_p_bh[0] == 'w') // 'bufhidden' == "wipe"
{
del_buf = TRUE;
unload_buf = TRUE;
wipe_buf = TRUE;
}
- else if (buf->b_p_bh[0] == 'u') /* 'bufhidden' == "unload" */
+ else if (buf->b_p_bh[0] == 'u') // 'bufhidden' == "unload"
unload_buf = TRUE;
#ifdef FEAT_TERMINAL
@@ -534,19 +534,19 @@
if (!can_unload_buffer(buf))
return;
- /* Wiping out or unloading a terminal buffer kills the job. */
+ // Wiping out or unloading a terminal buffer kills the job.
free_terminal(buf);
}
else
{
- /* The job keeps running, hide the buffer. */
+ // The job keeps running, hide the buffer.
del_buf = FALSE;
unload_buf = FALSE;
}
}
else
{
- /* A terminal buffer is wiped out if the job has finished. */
+ // A terminal buffer is wiped out if the job has finished.
del_buf = TRUE;
unload_buf = TRUE;
wipe_buf = TRUE;
@@ -554,18 +554,18 @@
}
#endif
- /* Disallow deleting the buffer when it is locked (already being closed or
- * halfway a command that relies on it). Unloading is allowed. */
+ // Disallow deleting the buffer when it is locked (already being closed or
+ // halfway a command that relies on it). Unloading is allowed.
if ((del_buf || wipe_buf) && !can_unload_buffer(buf))
return;
- /* check no autocommands closed the window */
+ // check no autocommands closed the window
if (win != NULL && win_valid_any_tab(win))
{
- /* Set b_last_cursor when closing the last window for the buffer.
- * Remember the last cursor position and window options of the buffer.
- * This used to be only for the current window, but then options like
- * 'foldmethod' may be lost with a ":only" command. */
+ // Set b_last_cursor when closing the last window for the buffer.
+ // Remember the last cursor position and window options of the buffer.
+ // This used to be only for the current window, but then options like
+ // 'foldmethod' may be lost with a ":only" command.
if (buf->b_nwindows == 1)
set_last_cursor(win);
buflist_setfpos(buf, win,
@@ -575,7 +575,7 @@
set_bufref(&bufref, buf);
- /* When the buffer is no longer in a window, trigger BufWinLeave */
+ // When the buffer is no longer in a window, trigger BufWinLeave
if (buf->b_nwindows == 1)
{
++buf->b_locked;
@@ -583,40 +583,40 @@
FALSE, buf)
&& !bufref_valid(&bufref))
{
- /* Autocommands deleted the buffer. */
+ // Autocommands deleted the buffer.
aucmd_abort:
emsg(_(e_auabort));
return;
}
--buf->b_locked;
if (abort_if_last && one_window())
- /* Autocommands made this the only window. */
+ // Autocommands made this the only window.
goto aucmd_abort;
- /* When the buffer becomes hidden, but is not unloaded, trigger
- * BufHidden */
+ // When the buffer becomes hidden, but is not unloaded, trigger
+ // BufHidden
if (!unload_buf)
{
++buf->b_locked;
if (apply_autocmds(EVENT_BUFHIDDEN, buf->b_fname, buf->b_fname,
FALSE, buf)
&& !bufref_valid(&bufref))
- /* Autocommands deleted the buffer. */
+ // Autocommands deleted the buffer.
goto aucmd_abort;
--buf->b_locked;
if (abort_if_last && one_window())
- /* Autocommands made this the only window. */
+ // Autocommands made this the only window.
goto aucmd_abort;
}
#ifdef FEAT_EVAL
- if (aborting()) /* autocmds may abort script processing */
+ if (aborting()) // autocmds may abort script processing
return;
#endif
}
- /* If the buffer was in curwin and the window has changed, go back to that
- * window, if it still exists. This avoids that ":edit x" triggering a
- * "tabnext" BufUnload autocmd leaves a window behind without a buffer. */
+ // If the buffer was in curwin and the window has changed, go back to that
+ // window, if it still exists. This avoids that ":edit x" triggering a
+ // "tabnext" BufUnload autocmd leaves a window behind without a buffer.
if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin))
{
block_autocmds();
@@ -626,26 +626,26 @@
nwindows = buf->b_nwindows;
- /* decrease the link count from windows (unless not in any window) */
+ // decrease the link count from windows (unless not in any window)
if (buf->b_nwindows > 0)
--buf->b_nwindows;
#ifdef FEAT_DIFF
if (diffopt_hiddenoff() && !unload_buf && buf->b_nwindows == 0)
- diff_buf_delete(buf); /* Clear 'diff' for hidden buffer. */
+ diff_buf_delete(buf); // Clear 'diff' for hidden buffer.
#endif
- /* Return when a window is displaying the buffer or when it's not
- * unloaded. */
+ // Return when a window is displaying the buffer or when it's not
+ // unloaded.
if (buf->b_nwindows > 0 || !unload_buf)
return;
- /* Always remove the buffer when there is no file name. */
+ // Always remove the buffer when there is no file name.
if (buf->b_ffname == NULL)
del_buf = TRUE;
- /* When closing the current buffer stop Visual mode before freeing
- * anything. */
+ // When closing the current buffer stop Visual mode before freeing
+ // anything.
if (buf == curbuf && VIsual_active
#if defined(EXITFREE)
&& !entered_free_all_mem
@@ -657,18 +657,18 @@
* Free all things allocated for this buffer.
* Also calls the "BufDelete" autocommands when del_buf is TRUE.
*/
- /* Remember if we are closing the current buffer. Restore the number of
- * windows, so that autocommands in buf_freeall() don't get confused. */
+ // Remember if we are closing the current buffer. Restore the number of
+ // windows, so that autocommands in buf_freeall() don't get confused.
is_curbuf = (buf == curbuf);
buf->b_nwindows = nwindows;
buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0));
- /* Autocommands may have deleted the buffer. */
+ // Autocommands may have deleted the buffer.
if (!bufref_valid(&bufref))
return;
#ifdef FEAT_EVAL
- if (aborting()) /* autocmds may abort script processing */
+ if (aborting()) // autocmds may abort script processing
return;
#endif
@@ -683,10 +683,10 @@
return;
if (win_valid_any_tab(win) && win->w_buffer == buf)
- win->w_buffer = NULL; /* make sure we don't use the buffer now */
+ win->w_buffer = NULL; // make sure we don't use the buffer now
- /* Autocommands may have opened or closed windows for this buffer.
- * Decrement the count for the close we do here. */
+ // Autocommands may have opened or closed windows for this buffer.
+ // Decrement the count for the close we do here.
if (buf->b_nwindows > 0)
--buf->b_nwindows;
@@ -722,14 +722,14 @@
{
if (del_buf)
{
- /* Free all internal variables and reset option values, to make
- * ":bdel" compatible with Vim 5.7. */
+ // Free all internal variables and reset option values, to make
+ // ":bdel" compatible with Vim 5.7.
free_buffer_stuff(buf, TRUE);
- /* Make it look like a new buffer. */
+ // Make it look like a new buffer.
buf->b_flags = BF_CHECK_RO | BF_NEVERLOADED;
- /* Init the options when loaded again. */
+ // Init the options when loaded again.
buf->b_p_initialized = FALSE;
}
buf_clear_file(buf);
@@ -752,7 +752,7 @@
buf->b_p_bomb = FALSE;
buf->b_start_bomb = FALSE;
buf->b_ml.ml_mfp = NULL;
- buf->b_ml.ml_flags = ML_EMPTY; /* empty buffer */
+ buf->b_ml.ml_flags = ML_EMPTY; // empty buffer
#ifdef FEAT_NETBEANS_INTG
netbeans_deleted_all_lines(buf);
#endif
@@ -775,7 +775,7 @@
win_T *the_curwin = curwin;
tabpage_T *the_curtab = curtab;
- /* Make sure the buffer isn't closed by autocommands. */
+ // Make sure the buffer isn't closed by autocommands.
++buf->b_locked;
set_bufref(&bufref, buf);
if (buf->b_ml.ml_mfp != NULL)
@@ -783,7 +783,7 @@
if (apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname,
FALSE, buf)
&& !bufref_valid(&bufref))
- /* autocommands deleted the buffer */
+ // autocommands deleted the buffer
return;
}
if ((flags & BFA_DEL) && buf->b_p_bl)
@@ -791,7 +791,7 @@
if (apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname,
FALSE, buf)
&& !bufref_valid(&bufref))
- /* autocommands deleted the buffer */
+ // autocommands deleted the buffer
return;
}
if (flags & BFA_WIPE)
@@ -799,14 +799,14 @@
if (apply_autocmds(EVENT_BUFWIPEOUT, buf->b_fname, buf->b_fname,
FALSE, buf)
&& !bufref_valid(&bufref))
- /* autocommands deleted the buffer */
+ // autocommands deleted the buffer
return;
}
--buf->b_locked;
- /* If the buffer was in curwin and the window has changed, go back to that
- * window, if it still exists. This avoids that ":edit x" triggering a
- * "tabnext" BufUnload autocmd leaves a window behind without a buffer. */
+ // If the buffer was in curwin and the window has changed, go back to that
+ // window, if it still exists. This avoids that ":edit x" triggering a
+ // "tabnext" BufUnload autocmd leaves a window behind without a buffer.
if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin))
{
block_autocmds();
@@ -815,7 +815,7 @@
}
#ifdef FEAT_EVAL
- if (aborting()) /* autocmds may abort script processing */
+ if (aborting()) // autocmds may abort script processing
return;
#endif
@@ -828,16 +828,16 @@
if (buf == curbuf && !is_curbuf)
return;
#ifdef FEAT_DIFF
- diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */
+ diff_buf_delete(buf); // Can't use 'diff' for unloaded buffer.
#endif
#ifdef FEAT_SYN_HL
- /* Remove any ownsyntax, unless exiting. */
+ // Remove any ownsyntax, unless exiting.
if (curwin != NULL && curwin->w_buffer == buf)
reset_synblock(curwin);
#endif
#ifdef FEAT_FOLDING
- /* No folds in an empty buffer. */
+ // No folds in an empty buffer.
{
win_T *win;
tabpage_T *tp;
@@ -851,20 +851,20 @@
#ifdef FEAT_TCL
tcl_buffer_free(buf);
#endif
- ml_close(buf, TRUE); /* close and delete the memline/memfile */
- buf->b_ml.ml_line_count = 0; /* no lines in buffer */
+ ml_close(buf, TRUE); // close and delete the memline/memfile
+ buf->b_ml.ml_line_count = 0; // no lines in buffer
if ((flags & BFA_KEEP_UNDO) == 0)
{
- u_blockfree(buf); /* free the memory allocated for undo */
- u_clearall(buf); /* reset all undo information */
+ u_blockfree(buf); // free the memory allocated for undo
+ u_clearall(buf); // reset all undo information
}
#ifdef FEAT_SYN_HL
- syntax_clear(&buf->b_s); /* reset syntax info */
+ syntax_clear(&buf->b_s); // reset syntax info
#endif
#ifdef FEAT_TEXT_PROP
clear_buf_prop_types(buf);
#endif
- buf->b_flags &= ~BF_READERR; /* a read error is no longer relevant */
+ buf->b_flags &= ~BF_READERR; // a read error is no longer relevant
}
/*
@@ -877,7 +877,7 @@
++buf_free_count;
free_buffer_stuff(buf, TRUE);
#ifdef FEAT_EVAL
- /* b:changedtick uses an item in buf_T, remove it now */
+ // b:changedtick uses an item in buf_T, remove it now
dictitem_remove(buf->b_vars, (dictitem_T *)&buf->b_ct_di);
unref_var_dict(buf->b_vars);
remove_listeners(buf);
@@ -918,8 +918,8 @@
if (autocmd_busy)
{
- /* Do not free the buffer structure while autocommands are executing,
- * it's still needed. Free it when autocmd_busy is reset. */
+ // Do not free the buffer structure while autocommands are executing,
+ // it's still needed. Free it when autocmd_busy is reset.
buf->b_next = au_pending_free_buf;
au_pending_free_buf = buf;
}
@@ -952,11 +952,11 @@
static void
free_buffer_stuff(
buf_T *buf,
- int free_options) /* free options as well */
+ int free_options) // free options as well
{
if (free_options)
{
- clear_wininfo(buf); /* including window-local options */
+ clear_wininfo(buf); // including window-local options
free_buf_options(buf, TRUE);
#ifdef FEAT_SPELL
ga_clear(&buf->b_s.b_langp);
@@ -966,7 +966,7 @@
{
varnumber_T tick = CHANGEDTICK(buf);
- vars_clear(&buf->b_vars->dv_hashtab); /* free all buffer variables */
+ vars_clear(&buf->b_vars->dv_hashtab); // free all buffer variables
hash_init(&buf->b_vars->dv_hashtab);
init_changedtick(buf);
CHANGEDTICK(buf) = tick;
@@ -979,8 +979,8 @@
#ifdef FEAT_NETBEANS_INTG
netbeans_file_killed(buf);
#endif
- map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
- map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
+ map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); // clear local mappings
+ map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); // clear local abbrevs
VIM_CLEAR(buf->b_start_fenc);
}
@@ -1029,19 +1029,19 @@
#if defined(FEAT_EVAL)
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);
#endif
- /* Quitting means closing the split window, nothing else. */
+ // Quitting means closing the split window, nothing else.
win_close(curwin, TRUE);
swap_exists_action = SEA_NONE;
swap_exists_did_quit = TRUE;
#if defined(FEAT_EVAL)
- /* 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);
#endif
}
@@ -1067,15 +1067,15 @@
if (swap_exists_action == SEA_QUIT)
{
#if defined(FEAT_EVAL)
- /* Reset the error/interrupt/exception state here so that
- * aborting() returns FALSE when closing a buffer. */
+ // Reset the error/interrupt/exception state here so that
+ // aborting() returns FALSE when closing a buffer.
enter_cleanup(&cs);
#endif
- /* User selected Quit at ATTENTION prompt. Go back to previous
- * buffer. If that buffer is gone or the same as the current one,
- * open a new, empty buffer. */
- swap_exists_action = SEA_NONE; /* don't want it again */
+ // User selected Quit at ATTENTION prompt. Go back to previous
+ // buffer. If that buffer is gone or the same as the current one,
+ // open a new, empty buffer.
+ swap_exists_action = SEA_NONE; // don't want it again
swap_exists_did_quit = TRUE;
close_buffer(curwin, curbuf, DOBUF_UNLOAD, FALSE);
if (old_curbuf == NULL || !bufref_valid(old_curbuf)
@@ -1098,32 +1098,32 @@
check_colorcolumn(curwin);
#endif
}
- /* If "old_curbuf" is NULL we are in big trouble here... */
+ // If "old_curbuf" is NULL we are in big trouble here...
#if defined(FEAT_EVAL)
- /* 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);
#endif
}
else if (swap_exists_action == SEA_RECOVER)
{
#if defined(FEAT_EVAL)
- /* Reset the error/interrupt/exception state here so that
- * aborting() returns FALSE when closing a buffer. */
+ // Reset the error/interrupt/exception state here so that
+ // aborting() returns FALSE when closing a buffer.
enter_cleanup(&cs);
#endif
- /* User selected Recover at ATTENTION prompt. */
+ // User selected Recover at ATTENTION prompt.
msg_scroll = TRUE;
ml_recover(FALSE);
- msg_puts("\n"); /* don't overwrite the last message */
+ msg_puts("\n"); // don't overwrite the last message
cmdline_row = msg_row;
do_modelines(0);
#if defined(FEAT_EVAL)
- /* 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);
#endif
}
@@ -1146,16 +1146,16 @@
char *
do_bufdel(
int command,
- char_u *arg, /* pointer to extra arguments */
+ char_u *arg, // pointer to extra arguments
int addr_count,
- int start_bnr, /* first buffer number in a range */
- int end_bnr, /* buffer nr or last buffer nr in a range */
+ int start_bnr, // first buffer number in a range
+ int end_bnr, // buffer nr or last buffer nr in a range
int forceit)
{
- int do_current = 0; /* delete current buffer? */
- int deleted = 0; /* number of buffers deleted */
- char *errormsg = NULL; /* return value */
- int bnr; /* buffer number */
+ int do_current = 0; // delete current buffer?
+ int deleted = 0; // number of buffers deleted
+ char *errormsg = NULL; // return value
+ int bnr; // buffer number
char_u *p;
if (addr_count == 0)
@@ -1166,11 +1166,11 @@
{
if (addr_count == 2)
{
- if (*arg) /* both range and argument is not allowed */
+ if (*arg) // both range and argument is not allowed
return _(e_trailing);
bnr = start_bnr;
}
- else /* addr_count == 1 */
+ else // addr_count == 1
bnr = end_bnr;
for ( ;!got_int; ui_breakcheck())
@@ -1195,7 +1195,7 @@
if (++bnr > end_bnr)
break;
}
- else /* addr_count == 1 */
+ else // addr_count == 1
{
arg = skipwhite(arg);
if (*arg == NUL)
@@ -1206,7 +1206,7 @@
bnr = buflist_findpat(arg, p,
command == DOBUF_WIPE || command == DOBUF_WIPE_REUSE,
FALSE, FALSE);
- if (bnr < 0) /* failed */
+ if (bnr < 0) // failed
break;
arg = p;
}
@@ -1268,7 +1268,7 @@
set_bufref(&bufref, buf);
if (close_others)
- /* Close any other windows on this buffer, then make it empty. */
+ // Close any other windows on this buffer, then make it empty.
close_windows(buf, TRUE);
setpcmark();
@@ -1308,9 +1308,9 @@
do_buffer(
int action,
int start,
- int dir, /* FORWARD or BACKWARD */
- int count, /* buffer number or number of buffers */
- int forceit) /* TRUE for :...! */
+ int dir, // FORWARD or BACKWARD
+ int count, // buffer number or number of buffers
+ int forceit) // TRUE for :...!
{
buf_T *buf;
buf_T *bp;
@@ -1323,7 +1323,7 @@
case DOBUF_LAST: buf = lastbuf; break;
default: buf = curbuf; break;
}
- if (start == DOBUF_MOD) /* find next modified buffer */
+ if (start == DOBUF_MOD) // find next modified buffer
{
while (count-- > 0)
{
@@ -1341,7 +1341,7 @@
return FAIL;
}
}
- else if (start == DOBUF_FIRST && count) /* find specified buffer number */
+ else if (start == DOBUF_FIRST && count) // find specified buffer number
{
while (buf != NULL && buf->b_fnum != count)
buf = buf->b_next;
@@ -1351,8 +1351,8 @@
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;
if (dir == FORWARD)
@@ -1367,26 +1367,26 @@
if (buf == NULL)
buf = lastbuf;
}
- /* don't count unlisted buffers */
+ // don't count unlisted buffers
if (unload || buf->b_p_bl)
{
--count;
- bp = NULL; /* use this buffer as new starting point */
+ bp = NULL; // use this buffer as new starting point
}
if (bp == buf)
{
- /* back where we started, didn't find anything. */
+ // back where we started, didn't find anything.
emsg(_("E85: There is no listed buffer"));
return FAIL;
}
}
}
- if (buf == NULL) /* could not find it */
+ if (buf == NULL) // could not find it
{
if (start == DOBUF_FIRST)
{
- /* don't warn when deleting */
+ // don't warn when deleting
if (!unload)
semsg(_(e_nobufnr), count);
}
@@ -1414,8 +1414,8 @@
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 && action != DOBUF_WIPE_REUSE
&& buf->b_ml.ml_mfp == NULL && !buf->b_p_bl)
return FAIL;
@@ -1427,11 +1427,11 @@
{
dialog_changed(buf, FALSE);
if (!bufref_valid(&bufref))
- /* Autocommand deleted buffer, oops! It's not changed
- * now. */
+ // Autocommand deleted buffer, oops! It's not changed
+ // now.
return FAIL;
- /* If it's still changed fail silently, the dialog already
- * mentioned why it fails. */
+ // If it's still changed fail silently, the dialog already
+ // mentioned why it fails.
if (bufIsChanged(buf))
return FAIL;
}
@@ -1444,7 +1444,7 @@
}
}
- /* When closing the current buffer stop Visual mode. */
+ // When closing the current buffer stop Visual mode.
if (buf == curbuf && VIsual_active)
end_visual_mode();
@@ -1492,8 +1492,8 @@
* then before the current buffer.
* Finally use any buffer.
*/
- buf = NULL; /* selected buffer */
- bp = NULL; /* used when no loaded buffer found */
+ buf = NULL; // selected buffer
+ bp = NULL; // used when no loaded buffer found
if (au_new_curbuf.br_buf != NULL && bufref_valid(&au_new_curbuf))
buf = au_new_curbuf.br_buf;
#ifdef FEAT_JUMPLIST
@@ -1512,29 +1512,29 @@
if (buf != NULL)
{
if (buf == curbuf || !buf->b_p_bl)
- buf = NULL; /* skip current and unlisted bufs */
+ buf = NULL; // skip current and unlisted bufs
else if (buf->b_ml.ml_mfp == NULL)
{
- /* skip unloaded buf, but may keep it for later */
+ // skip unloaded buf, but may keep it for later
if (bp == NULL)
bp = buf;
buf = NULL;
}
}
- if (buf != NULL) /* found a valid buffer: stop searching */
+ if (buf != NULL) // found a valid buffer: stop searching
break;
- /* advance to older entry in jump list */
+ // advance to older entry in jump list
if (!jumpidx && curwin->w_jumplistidx == curwin->w_jumplistlen)
break;
if (--jumpidx < 0)
jumpidx = curwin->w_jumplistlen - 1;
- if (jumpidx == forward) /* List exhausted for sure */
+ if (jumpidx == forward) // List exhausted for sure
break;
}
}
#endif
- if (buf == NULL) /* No previous buffer, Try 2'nd approach */
+ if (buf == NULL) // No previous buffer, Try 2'nd approach
{
forward = TRUE;
buf = curbuf->b_next;
@@ -1542,18 +1542,18 @@
{
if (buf == NULL)
{
- if (!forward) /* tried both directions */
+ if (!forward) // tried both directions
break;
buf = curbuf->b_prev;
forward = FALSE;
continue;
}
- /* in non-help buffer, try to skip help buffers, and vv */
+ // in non-help buffer, try to skip help buffers, and vv
if (buf->b_help == curbuf->b_help && buf->b_p_bl)
{
- if (buf->b_ml.ml_mfp != NULL) /* found loaded buffer */
+ if (buf->b_ml.ml_mfp != NULL) // found loaded buffer
break;
- if (bp == NULL) /* remember unloaded buf for later */
+ if (bp == NULL) // remember unloaded buf for later
bp = buf;
}
if (forward)
@@ -1562,15 +1562,15 @@
buf = buf->b_prev;
}
}
- if (buf == NULL) /* No loaded buffer, use unloaded one */
+ if (buf == NULL) // No loaded buffer, use unloaded one
buf = bp;
- if (buf == NULL) /* No loaded buffer, find listed one */
+ if (buf == NULL) // No loaded buffer, find listed one
{
FOR_ALL_BUFFERS(buf)
if (buf->b_p_bl && buf != curbuf)
break;
}
- if (buf == NULL) /* Still no buffer, just take one */
+ if (buf == NULL) // Still no buffer, just take one
{
if (curbuf->b_next != NULL)
buf = curbuf->b_next;
@@ -1581,29 +1581,29 @@
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);
}
/*
* make buf current buffer
*/
- if (action == DOBUF_SPLIT) /* split window first */
+ if (action == DOBUF_SPLIT) // split window first
{
- /* If 'switchbuf' contains "useopen": jump to first window containing
- * "buf" if one exists */
+ // If 'switchbuf' contains "useopen": jump to first window containing
+ // "buf" if one exists
if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
return OK;
- /* If 'switchbuf' contains "usetab": jump to first window in any tab
- * page containing "buf" if one exists */
+ // If 'switchbuf' contains "usetab": jump to first window in any tab
+ // page containing "buf" if one exists
if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
return OK;
if (win_split(0, 0) == FAIL)
return FAIL;
}
- /* go to current buffer - nothing to do */
+ // go to current buffer - nothing to do
if (buf == curbuf)
return OK;
@@ -1620,7 +1620,7 @@
set_bufref(&bufref, buf);
dialog_changed(curbuf, FALSE);
if (!bufref_valid(&bufref))
- /* Autocommand deleted buffer, oops! */
+ // Autocommand deleted buffer, oops!
return FAIL;
}
if (bufIsChanged(curbuf))
@@ -1631,14 +1631,14 @@
}
}
- /* Go to the other buffer. */
+ // Go to the other buffer.
set_curbuf(buf, action);
if (action == DOBUF_SPLIT)
- RESET_BINDING(curwin); /* reset 'scrollbind' and 'cursorbind' */
+ RESET_BINDING(curwin); // reset 'scrollbind' and 'cursorbind'
#if defined(FEAT_EVAL)
- if (aborting()) /* autocmds may abort script processing */
+ if (aborting()) // autocmds may abort script processing
return FAIL;
#endif
@@ -1669,20 +1669,19 @@
setpcmark();
if (!cmdmod.keepalt)
- curwin->w_alt_fnum = curbuf->b_fnum; /* remember alternate file */
- buflist_altfpos(curwin); /* remember curpos */
+ curwin->w_alt_fnum = curbuf->b_fnum; // remember alternate file
+ buflist_altfpos(curwin); // remember curpos
- /* Don't restart Select mode after switching to another buffer. */
+ // Don't restart Select mode after switching to another buffer.
VIsual_reselect = FALSE;
- /* close_windows() or apply_autocmds() may change curbuf and wipe out "buf"
- */
+ // close_windows() or apply_autocmds() may change curbuf and wipe out "buf"
prevbuf = curbuf;
set_bufref(&prevbufref, prevbuf);
set_bufref(&newbufref, buf);
- /* Autocommands may delete the curren buffer and/or the buffer we wan to go
- * to. In those cases don't close the buffer. */
+ // Autocommands may delete the curren buffer and/or the buffer we wan to go
+ // to. In those cases don't close the buffer.
if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf)
|| (bufref_valid(&prevbufref)
&& bufref_valid(&newbufref)
@@ -1711,13 +1710,13 @@
&& !buf_hide(prevbuf)
&& !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0, FALSE);
if (curwin != previouswin && win_valid(previouswin))
- /* autocommands changed curwin, Grr! */
+ // autocommands changed curwin, Grr!
curwin = previouswin;
}
}
- /* 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
#ifdef FEAT_EVAL
&& !aborting()
@@ -1765,25 +1764,25 @@
curwin->w_s = &(curbuf->b_s);
#endif
- /* Cursor on first line by default. */
+ // Cursor on first line by default.
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
curwin->w_cursor.coladd = 0;
curwin->w_set_curswant = TRUE;
curwin->w_topline_was_set = FALSE;
- /* mark cursor position as being invalid */
+ // mark cursor position as being invalid
curwin->w_valid = 0;
buflist_setfpos(curbuf, curwin, curbuf->b_last_cursor.lnum,
curbuf->b_last_cursor.col, TRUE);
- /* Make sure the buffer is loaded. */
- if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
+ // Make sure the buffer is loaded.
+ if (curbuf->b_ml.ml_mfp == NULL) // need to load the file
{
- /* If there is no filetype, allow for detecting one. Esp. useful for
- * ":ball" used in a autocommand. If there already is a filetype we
- * might prefer to keep it. */
+ // If there is no filetype, allow for detecting one. Esp. useful for
+ // ":ball" used in a autocommand. If there already is a filetype we
+ // might prefer to keep it.
if (*curbuf->b_p_ft == NUL)
did_filetype = FALSE;
@@ -1805,25 +1804,25 @@
apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf);
}
- /* If autocommands did not change the cursor position, restore cursor lnum
- * and possibly cursor col. */
+ // If autocommands did not change the cursor position, restore cursor lnum
+ // and possibly cursor col.
if (curwin->w_cursor.lnum == 1 && inindent(0))
buflist_getfpos();
- check_arg_idx(curwin); /* check for valid arg_idx */
+ check_arg_idx(curwin); // check for valid arg_idx
#ifdef FEAT_TITLE
maketitle();
#endif
- /* when autocmds didn't change it */
+ // when autocmds didn't change it
if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
- scroll_cursor_halfway(FALSE); /* redisplay at correct position */
+ scroll_cursor_halfway(FALSE); // redisplay at correct position
#ifdef FEAT_NETBEANS_INTG
- /* Send fileOpened event because we've changed buffers. */
+ // Send fileOpened event because we've changed buffers.
netbeans_file_activated(curbuf);
#endif
- /* Change directories when the 'acd' option is set. */
+ // Change directories when the 'acd' option is set.
DO_AUTOCHDIR;
#ifdef FEAT_KEYMAP
@@ -1831,8 +1830,8 @@
(void)keymap_init();
#endif
#ifdef FEAT_SPELL
- /* May need to set the spell language. Can only do this after the buffer
- * has been properly setup. */
+ // May need to set the spell language. Can only do this after the buffer
+ // has been properly setup.
if (!curbuf->b_help && curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL)
(void)did_set_spelllang(curwin);
#endif
@@ -1937,8 +1936,8 @@
* If file name already exists in the list, update the entry.
*/
#ifdef UNIX
- /* On Unix we can use inode numbers when the file exists. Works better
- * for hard links. */
+ // On Unix we can use inode numbers when the file exists. Works better
+ // for hard links.
if (sfname == NULL || mch_stat((char *)sfname, &st) < 0)
st.st_dev = (dev_T)-1;
#endif
@@ -1955,8 +1954,8 @@
buflist_setfpos(buf, curwin, lnum, (colnr_T)0, FALSE);
if ((flags & BLN_NOOPT) == 0)
- /* copy the options now, if 'cpo' doesn't have 's' and not done
- * already */
+ // copy the options now, if 'cpo' doesn't have 's' and not done
+ // already
buf_copy_options(buf, 0);
if ((flags & BLN_LISTED) && !buf->b_p_bl)
@@ -1987,19 +1986,19 @@
if ((flags & BLN_CURBUF) && curbuf_reusable())
{
buf = curbuf;
- /* It's like this buffer is deleted. Watch out for autocommands that
- * change curbuf! If that happens, allocate a new buffer anyway. */
+ // It's like this buffer is deleted. Watch out for autocommands that
+ // change curbuf! If that happens, allocate a new buffer anyway.
if (curbuf->b_p_bl)
apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf);
if (buf == curbuf)
apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf);
#ifdef FEAT_EVAL
- if (aborting()) /* autocmds may abort script processing */
+ if (aborting()) // autocmds may abort script processing
return NULL;
#endif
if (buf == curbuf)
{
- /* Make sure 'bufhidden' and 'buftype' are empty */
+ // Make sure 'bufhidden' and 'buftype' are empty
clear_string_option(&buf->b_p_bh);
clear_string_option(&buf->b_p_bt);
}
@@ -2013,7 +2012,7 @@
return NULL;
}
#ifdef FEAT_EVAL
- /* init b: variables */
+ // init b: variables
buf->b_vars = dict_alloc();
if (buf->b_vars == NULL)
{
@@ -2050,22 +2049,22 @@
if (buf == curbuf)
{
- /* free all things allocated for this buffer */
+ // free all things allocated for this buffer
buf_freeall(buf, 0);
- if (buf != curbuf) /* autocommands deleted the buffer! */
+ if (buf != curbuf) // autocommands deleted the buffer!
return NULL;
#if defined(FEAT_EVAL)
- if (aborting()) /* autocmds may abort script processing */
+ if (aborting()) // autocmds may abort script processing
return NULL;
#endif
- free_buffer_stuff(buf, FALSE); /* delete local variables et al. */
+ free_buffer_stuff(buf, FALSE); // delete local variables et al.
- /* Init the options. */
+ // Init the options.
buf->b_p_initialized = FALSE;
buf_copy_options(buf, BCO_ENTER);
#ifdef FEAT_KEYMAP
- /* need to reload lmaps and set b:keymap_name */
+ // need to reload lmaps and set b:keymap_name
curbuf->b_kmap_state |= KEYMAP_INIT;
#endif
}
@@ -2075,12 +2074,12 @@
* put new buffer at the end of the buffer list
*/
buf->b_next = NULL;
- if (firstbuf == NULL) /* buffer list is empty */
+ if (firstbuf == NULL) // buffer list is empty
{
buf->b_prev = NULL;
firstbuf = buf;
}
- else /* append new buffer at end of list */
+ else // append new buffer at end of list
{
lastbuf->b_next = buf;
buf->b_prev = lastbuf;
@@ -2097,7 +2096,7 @@
}
else
buf->b_fnum = top_file_num++;
- if (top_file_num < 0) /* wrap around (may cause duplicates) */
+ if (top_file_num < 0) // wrap around (may cause duplicates)
{
emsg(_("W14: Warning: List of file names overflow"));
if (emsg_silent == 0)
@@ -2139,16 +2138,16 @@
if (flags & BLN_DUMMY)
buf->b_flags |= BF_DUMMY;
buf_clear_file(buf);
- clrallmarks(buf); /* clear marks */
- fmarks_check_names(buf); /* check file marks for this file */
- buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */
+ clrallmarks(buf); // clear marks
+ fmarks_check_names(buf); // check file marks for this file
+ buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; // init 'buflisted'
if (!(flags & BLN_DUMMY))
{
bufref_T bufref;
- /* Tricky: these autocommands may change the buffer list. They could
- * also split the window with re-using the one empty buffer. This may
- * result in unexpectedly losing the empty buffer. */
+ // Tricky: these autocommands may change the buffer list. They could
+ // also split the window with re-using the one empty buffer. This may
+ // result in unexpectedly losing the empty buffer.
set_bufref(&bufref, buf);
if (apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, buf)
&& !bufref_valid(&bufref))
@@ -2160,7 +2159,7 @@
return NULL;
}
#ifdef FEAT_EVAL
- if (aborting()) /* autocmds may abort script processing */
+ if (aborting()) // autocmds may abort script processing
return NULL;
#endif
}
@@ -2318,7 +2317,7 @@
return FAIL;
}
- /* if alternate file is the current buffer, nothing to do */
+ // if alternate file is the current buffer, nothing to do
if (buf == curbuf)
return OK;
@@ -2330,7 +2329,7 @@
if (curbuf_locked())
return FAIL;
- /* altfpos may be changed by getfile(), get it now */
+ // altfpos may be changed by getfile(), get it now
if (lnum == 0)
{
fpos = buflist_findfpos(buf);
@@ -2342,18 +2341,18 @@
if (options & GETF_SWITCH)
{
- /* If 'switchbuf' contains "useopen": jump to first window containing
- * "buf" if one exists */
+ // If 'switchbuf' contains "useopen": jump to first window containing
+ // "buf" if one exists
if (swb_flags & SWB_USEOPEN)
wp = buf_jump_open_win(buf);
- /* If 'switchbuf' contains "usetab": jump to first window in any tab
- * page containing "buf" if one exists */
+ // If 'switchbuf' contains "usetab": jump to first window in any tab
+ // page containing "buf" if one exists
if (wp == NULL && (swb_flags & SWB_USETAB))
wp = buf_jump_open_tab(buf);
- /* If 'switchbuf' contains "split", "vsplit" or "newtab" and the
- * current buffer isn't empty: open new tab or window */
+ // If 'switchbuf' contains "split", "vsplit" or "newtab" and the
+ // current buffer isn't empty: open new tab or window
if (wp == NULL && (swb_flags & (SWB_VSPLIT | SWB_SPLIT | SWB_NEWTAB))
&& !BUFEMPTY())
{
@@ -2372,7 +2371,7 @@
{
--RedrawingDisabled;
- /* cursor is at to BOL and w_cursor.lnum is checked due to getfile() */
+ // cursor is at to BOL and w_cursor.lnum is checked due to getfile()
if (!p_sol && col != 0)
{
curwin->w_cursor.col = col;
@@ -2421,10 +2420,10 @@
char_u *ffname;
buf_T *buf = NULL;
- /* First make the name into a full path name */
+ // First make the name into a full path name
ffname = FullName_save(fname,
#ifdef UNIX
- TRUE /* force expansion, get rid of symbolic links */
+ TRUE // force expansion, get rid of symbolic links
#else
FALSE
#endif
@@ -2468,7 +2467,7 @@
#endif
buf_T *buf;
- /* Start at the last buffer, expect to find a match sooner. */
+ // Start at the last buffer, expect to find a match sooner.
for (buf = lastbuf; buf != NULL; buf = buf->b_prev)
if ((buf->b_flags & BF_DUMMY) == 0 && !otherfile_buf(buf, ffname
#ifdef UNIX
@@ -2487,10 +2486,10 @@
int
buflist_findpat(
char_u *pattern,
- char_u *pattern_end, /* pointer to first char after pattern */
- int unlisted, /* find unlisted buffers */
- int diffmode UNUSED, /* find diff-mode buffers only */
- int curtab_only) /* find buffers in current tab only */
+ char_u *pattern_end, // pointer to first char after pattern
+ int unlisted, // find unlisted buffers
+ int diffmode UNUSED, // find diff-mode buffers only
+ int curtab_only) // find buffers in current tab only
{
buf_T *buf;
int match = -1;
@@ -2530,8 +2529,8 @@
patend = pat + STRLEN(pat) - 1;
toggledollar = (patend > pat && *patend == '$');
- /* First try finding a listed buffer. If not found and "unlisted"
- * is TRUE, try finding an unlisted buffer. */
+ // First try finding a listed buffer. If not found and "unlisted"
+ // is TRUE, try finding an unlisted buffer.
find_listed = TRUE;
for (;;)
{
@@ -2539,11 +2538,11 @@
{
regmatch_T regmatch;
- /* may add '^' and '$' */
+ // may add '^' and '$'
if (toggledollar)
- *patend = (attempt < 2) ? NUL : '$'; /* add/remove '$' */
+ *patend = (attempt < 2) ? NUL : '$'; // add/remove '$'
p = pat;
- if (*p == '^' && !(attempt & 1)) /* add/remove '^' */
+ if (*p == '^' && !(attempt & 1)) // add/remove '^'
++p;
regmatch.regprog = vim_regcomp(p, p_magic ? RE_MAGIC : 0);
if (regmatch.regprog == NULL)
@@ -2561,8 +2560,8 @@
{
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.
win_T *wp;
FOR_ALL_WINDOWS(wp)
@@ -2571,21 +2570,21 @@
if (wp == NULL)
continue;
}
- if (match >= 0) /* already found a match */
+ if (match >= 0) // already found a match
{
match = -2;
break;
}
- match = buf->b_fnum; /* remember first match */
+ match = buf->b_fnum; // remember first match
}
vim_regfree(regmatch.regprog);
- if (match >= 0) /* found one match */
+ if (match >= 0) // found one match
break;
}
- /* Only search for unlisted buffers if there was no match with
- * a listed buffer. */
+ // Only search for unlisted buffers if there was no match with
+ // a listed buffer.
if (!unlisted || !find_listed || match != -1)
break;
find_listed = FALSE;
@@ -2630,10 +2629,10 @@
bufmatch_T *matches = NULL;
#endif
- *num_file = 0; /* return values in case of FAIL */
+ *num_file = 0; // return values in case of FAIL
*file = NULL;
- /* Make a copy of "pat" and change "^" to "\(^\|[\/]\)". */
+ // Make a copy of "pat" and change "^" to "\(^\|[\/]\)".
if (*pat == '^')
{
patc = alloc(STRLEN(pat) + 11);
@@ -2654,7 +2653,7 @@
regmatch_T regmatch;
if (attempt > 0 && patc == pat)
- break; /* there was no anchor, no need to try again */
+ break; // there was no anchor, no need to try again
regmatch.regprog = vim_regcomp(patc + attempt * 11, RE_MAGIC);
if (regmatch.regprog == NULL)
{
@@ -2672,7 +2671,7 @@
count = 0;
FOR_ALL_BUFFERS(buf)
{
- if (!buf->b_p_bl) /* skip unlisted buffers */
+ if (!buf->b_p_bl) // skip unlisted buffers
continue;
p = buflist_match(®match, buf, p_wic);
if (p != NULL)
@@ -2698,7 +2697,7 @@
}
}
}
- if (count == 0) /* no match found, break here */
+ if (count == 0) // no match found, break here
break;
if (round == 1)
{
@@ -2717,7 +2716,7 @@
}
}
vim_regfree(regmatch.regprog);
- if (count) /* match(es) found, break here */
+ if (count) // match(es) found, break here
break;
}
@@ -2757,11 +2756,11 @@
buflist_match(
regmatch_T *rmp,
buf_T *buf,
- int ignore_case) /* when TRUE ignore case, when FALSE use 'fic' */
+ int ignore_case) // when TRUE ignore case, when FALSE use 'fic'
{
char_u *match;
- /* First try the short file name, then the long file name. */
+ // First try the short file name, then the long file name.
match = fname_match(rmp, buf->b_sfname, ignore_case);
if (match == NULL)
match = fname_match(rmp, buf->b_ffname, ignore_case);
@@ -2777,20 +2776,20 @@
fname_match(
regmatch_T *rmp,
char_u *name,
- int ignore_case) /* when TRUE ignore case, when FALSE use 'fic' */
+ int ignore_case) // when TRUE ignore case, when FALSE use 'fic'
{
char_u *match = NULL;
char_u *p;
if (name != NULL)
{
- /* Ignore case when 'fileignorecase' or the argument is set. */
+ // Ignore case when 'fileignorecase' or the argument is set.
rmp->rm_ic = p_fic || ignore_case;
if (vim_regexec(rmp, name, (colnr_T)0))
match = name;
else
{
- /* Replace $(HOME) with '~' and try matching again. */
+ // Replace $(HOME) with '~' and try matching again.
p = home_replace_save(NULL, name);
if (p != NULL && vim_regexec(rmp, p, (colnr_T)0))
match = name;
@@ -2831,7 +2830,7 @@
buflist_nr2name(
int n,
int fullname,
- int helptail) /* for help buffers return tail only */
+ int helptail) // for help buffers return tail only
{
buf_T *buf;
@@ -2862,17 +2861,17 @@
break;
if (wip == NULL)
{
- /* allocate a new entry */
+ // allocate a new entry
wip = ALLOC_CLEAR_ONE(wininfo_T);
if (wip == NULL)
return;
wip->wi_win = win;
- if (lnum == 0) /* set lnum even when it's 0 */
+ if (lnum == 0) // set lnum even when it's 0
lnum = 1;
}
else
{
- /* remove the entry from the list */
+ // remove the entry from the list
if (wip->wi_prev)
wip->wi_prev->wi_next = wip->wi_next;
else
@@ -2894,7 +2893,7 @@
}
if (copy_options)
{
- /* Save the window-specific option values. */
+ // Save the window-specific option values.
copy_winopt(&win->w_onebuf_opt, &wip->wi_opt);
#ifdef FEAT_FOLDING
wip->wi_fold_manual = win->w_fold_manual;
@@ -2903,7 +2902,7 @@
wip->wi_optset = TRUE;
}
- /* insert the entry in front of the list */
+ // insert the entry in front of the list
wip->wi_next = buf->b_wininfo;
buf->b_wininfo = wip;
wip->wi_prev = NULL;
@@ -2926,8 +2925,8 @@
if (wip->wi_opt.wo_diff)
{
FOR_ALL_WINDOWS(wp)
- /* return FALSE when it's a window in the current tab page, thus
- * the buffer was in diff mode here */
+ // return FALSE when it's a window in the current tab page, thus
+ // the buffer was in diff mode here
if (wip->wi_win == wp)
return FALSE;
return TRUE;
@@ -2958,8 +2957,8 @@
)
break;
- /* If no wininfo for curwin, use the first in the list (that doesn't have
- * 'diff' set and is in another tab page). */
+ // If no wininfo for curwin, use the first in the list (that doesn't have
+ // 'diff' set and is in another tab page).
if (wip == NULL)
{
#ifdef FEAT_DIFF
@@ -2996,8 +2995,8 @@
if (wip != NULL && wip->wi_win != NULL
&& wip->wi_win != curwin && wip->wi_win->w_buffer == buf)
{
- /* The buffer is currently displayed in the window: use the actual
- * option values instead of the saved (possibly outdated) values. */
+ // The buffer is currently displayed in the window: use the actual
+ // option values instead of the saved (possibly outdated) values.
win_T *wp = wip->wi_win;
copy_winopt(&wp->w_onebuf_opt, &curwin->w_onebuf_opt);
@@ -3009,7 +3008,7 @@
}
else if (wip != NULL && wip->wi_optset)
{
- /* the buffer was displayed in the current window earlier */
+ // the buffer was displayed in the current window earlier
copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt);
#ifdef FEAT_FOLDING
curwin->w_fold_manual = wip->wi_fold_manual;
@@ -3021,7 +3020,7 @@
copy_winopt(&curwin->w_allbuf_opt, &curwin->w_onebuf_opt);
#ifdef FEAT_FOLDING
- /* Set 'foldlevel' to 'foldlevelstart' if it's not negative. */
+ // Set 'foldlevel' to 'foldlevelstart' if it's not negative.
if (p_fdls >= 0)
curwin->w_p_fdl = p_fdls;
#endif
@@ -3103,7 +3102,7 @@
job_running = term_job_running(buf->b_term);
job_none_open = job_running && term_none_open(buf->b_term);
#endif
- /* skip unlisted buffers, unless ! was used */
+ // skip unlisted buffers, unless ! was used
if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u'))
|| (vim_strchr(eap->arg, 'u') && buf->b_p_bl)
|| (vim_strchr(eap->arg, '+')
@@ -3143,8 +3142,8 @@
ro_char = '?';
else
ro_char = 'R';
- changed_char = ' '; /* bufIsChanged() returns TRUE to avoid
- * closing, but it's not actually changed. */
+ changed_char = ' '; // bufIsChanged() returns TRUE to avoid
+ // closing, but it's not actually changed.
}
else if (buf->b_term != NULL)
ro_char = 'F';
@@ -3166,7 +3165,7 @@
if (len > IOSIZE - 20)
len = IOSIZE - 20;
- /* put "line 999" in column 40 or after the file name */
+ // put "line 999" in column 40 or after the file name
i = 40 - vim_strsize(IObuff);
do
IObuff[len++] = ' ';
@@ -3180,7 +3179,7 @@
_("line %ld"), buf == curbuf ? curwin->w_cursor.lnum
: (long)buflist_findlnum(buf));
msg_outtrans(IObuff);
- out_flush(); /* output one line at a time */
+ out_flush(); // output one line at a time
ui_breakcheck();
}
@@ -3226,7 +3225,7 @@
buf_T *buf,
char_u *ffname_arg,
char_u *sfname_arg,
- int message) /* give message when buffer already exists */
+ int message) // give message when buffer already exists
{
char_u *ffname = ffname_arg;
char_u *sfname = sfname_arg;
@@ -3237,7 +3236,7 @@
if (ffname == NULL || *ffname == NUL)
{
- /* Removing the name. */
+ // Removing the name.
if (buf->b_sfname != buf->b_ffname)
VIM_CLEAR(buf->b_sfname);
else
@@ -3249,8 +3248,8 @@
}
else
{
- fname_expand(buf, &ffname, &sfname); /* will allocate ffname */
- if (ffname == NULL) /* out of memory */
+ fname_expand(buf, &ffname, &sfname); // will allocate ffname
+ if (ffname == NULL) // out of memory
return FAIL;
/*
@@ -3270,14 +3269,14 @@
#endif
if (obuf != NULL && obuf != buf)
{
- if (obuf->b_ml.ml_mfp != NULL) /* it's loaded, fail */
+ if (obuf->b_ml.ml_mfp != NULL) // it's loaded, fail
{
if (message)
emsg(_("E95: Buffer with this name already exists"));
vim_free(ffname);
return FAIL;
}
- /* delete from the list */
+ // delete from the list
close_buffer(NULL, obuf, DOBUF_WIPE, FALSE);
}
sfname = vim_strsave(sfname);
@@ -3288,7 +3287,7 @@
return FAIL;
}
#ifdef USE_FNAME_CASE
- fname_case(sfname, 0); /* set correct case for short file name */
+ fname_case(sfname, 0); // set correct case for short file name
#endif
if (buf->b_sfname != buf->b_ffname)
vim_free(buf->b_sfname);
@@ -3331,8 +3330,8 @@
vim_free(buf->b_ffname);
buf->b_ffname = vim_strsave(name);
buf->b_sfname = NULL;
- /* Allocate ffname and expand into full path. Also resolves .lnk
- * files on Win32. */
+ // Allocate ffname and expand into full path. Also resolves .lnk
+ // files on Win32.
fname_expand(buf, &buf->b_ffname, &buf->b_sfname);
buf->b_fname = buf->b_sfname;
}
@@ -3352,13 +3351,13 @@
ml_setname(buf);
if (curwin->w_buffer == buf)
- check_arg_idx(curwin); /* check file name for arg list */
+ check_arg_idx(curwin); // check file name for arg list
#ifdef FEAT_TITLE
- maketitle(); /* set window title */
+ maketitle(); // set window title
#endif
- status_redraw_all(); /* status lines need to be redrawn */
- fmarks_check_names(buf); /* check named file marks */
- ml_timestamp(buf); /* reset timestamp */
+ status_redraw_all(); // status lines need to be redrawn
+ fmarks_check_names(buf); // check named file marks
+ ml_timestamp(buf); // reset timestamp
}
/*
@@ -3375,7 +3374,7 @@
{
buf_T *buf;
- /* Create a buffer. 'buflisted' is not set if it's a new buffer */
+ // Create a buffer. 'buflisted' is not set if it's a new buffer
buf = buflist_new(ffname, sfname, lnum, 0);
if (buf != NULL && !cmdmod.keepalt)
curwin->w_alt_fnum = buf->b_fnum;
@@ -3388,7 +3387,7 @@
*/
char_u *
getaltfname(
- int errmsg) /* give error message */
+ int errmsg) // give error message
{
char_u *fname;
linenr_T dummy;
@@ -3471,7 +3470,7 @@
#endif
)
{
- /* no name is different */
+ // no name is different
if (ffname == NULL || *ffname == NUL || buf->b_ffname == NULL)
return TRUE;
if (fnamecmp(ffname, buf->b_ffname) == 0)
@@ -3480,22 +3479,22 @@
{
stat_T st;
- /* If no stat_T given, get it now */
+ // If no stat_T given, get it now
if (stp == NULL)
{
if (!buf->b_dev_valid || mch_stat((char *)ffname, &st) < 0)
st.st_dev = (dev_T)-1;
stp = &st;
}
- /* Use dev/ino to check if the files are the same, even when the names
- * are different (possible with links). Still need to compare the
- * name above, for when the file doesn't exist yet.
- * Problem: The dev/ino changes when a file is deleted (and created
- * again) and remains the same when renamed/moved. We don't want to
- * mch_stat() each buffer each time, that would be too slow. Get the
- * dev/ino again when they appear to match, but not when they appear
- * to be different: Could skip a buffer when it's actually the same
- * file. */
+ // Use dev/ino to check if the files are the same, even when the names
+ // are different (possible with links). Still need to compare the
+ // name above, for when the file doesn't exist yet.
+ // Problem: The dev/ino changes when a file is deleted (and created
+ // again) and remains the same when renamed/moved. We don't want to
+ // mch_stat() each buffer each time, that would be too slow. Get the
+ // dev/ino again when they appear to match, but not when they appear
+ // to be different: Could skip a buffer when it's actually the same
+ // file.
if (buf_same_ino(buf, stp))
{
buf_setino(buf);
@@ -3546,7 +3545,7 @@
*/
void
fileinfo(
- int fullname, /* when non-zero print full path */
+ int fullname, // when non-zero print full path
int shorthelp,
int dont_truncate)
{
@@ -3560,7 +3559,7 @@
if (buffer == NULL)
return;
- if (fullname > 1) /* 2 CTRL-G: include buffer number */
+ if (fullname > 1) // 2 CTRL-G: include buffer number
{
vim_snprintf(buffer, IOSIZE, "buf %d: ", curbuf->b_fnum);
p = buffer + STRLEN(buffer);
@@ -3600,8 +3599,8 @@
(curbufIsChanged() || (curbuf->b_flags & BF_WRITE_MASK)
|| curbuf->b_p_ro) ?
" " : "");
- /* With 32 bit longs and more than 21,474,836 lines multiplying by 100
- * causes an overflow, thus for large numbers divide instead. */
+ // With 32 bit longs and more than 21,474,836 lines multiplying by 100
+ // causes an overflow, thus for large numbers divide instead.
if (curwin->w_cursor.lnum > 1000000L)
n = (int)(((long)curwin->w_cursor.lnum) /
((long)curbuf->b_ml.ml_line_count / 100L));
@@ -3612,7 +3611,7 @@
vim_snprintf_add(buffer, IOSIZE, "%s", _(no_lines_msg));
#ifdef FEAT_CMDL_INFO
else if (p_ru)
- /* Current line and column are already on the screen -- webb */
+ // Current line and column are already on the screen -- webb
vim_snprintf_add(buffer, IOSIZE,
NGETTEXT("%ld line --%d%%--", "%ld lines --%d%%--",
curbuf->b_ml.ml_line_count),
@@ -3636,8 +3635,8 @@
if (dont_truncate)
{
- /* Temporarily set msg_scroll to avoid the message being truncated.
- * First call msg_start() to get the message in the right place. */
+ // Temporarily set msg_scroll to avoid the message being truncated.
+ // First call msg_start() to get the message in the right place.
msg_start();
n = msg_scroll;
msg_scroll = TRUE;
@@ -3648,11 +3647,11 @@
{
p = (char *)msg_trunc_attr(buffer, FALSE, 0);
if (restart_edit != 0 || (msg_scrolled && !need_wait_return))
- /* Need to repeat the message after redrawing when:
- * - When restart_edit is set (otherwise there will be a delay
- * before redrawing).
- * - When the screen was scrolled but there is no wait-return
- * prompt. */
+ // Need to repeat the message after redrawing when:
+ // - When restart_edit is set (otherwise there will be a delay
+ // before redrawing).
+ // - When the screen was scrolled but there is no wait-return
+ // prompt.
set_keep_msg((char_u *)p, 0);
}
@@ -3693,7 +3692,7 @@
if (!redrawing())
{
- /* Postpone updating the title when 'lazyredraw' is set. */
+ // Postpone updating the title when 'lazyredraw' is set.
need_maketitle = TRUE;
return;
}
@@ -3738,11 +3737,11 @@
}
else
{
- /* format: "fname + (path) (1 of 2) - VIM" */
+ // format: "fname + (path) (1 of 2) - VIM"
#define SPACE_FOR_FNAME (IOSIZE - 100)
#define SPACE_FOR_DIR (IOSIZE - 20)
-#define SPACE_FOR_ARGNR (IOSIZE - 10) /* at least room for " - VIM" */
+#define SPACE_FOR_ARGNR (IOSIZE - 10) // at least room for " - VIM"
if (curbuf->b_fname == NULL)
vim_strncpy(buf, (char_u *)_("[No Name]"), SPACE_FOR_FNAME);
#ifdef FEAT_TERMINAL
@@ -3781,31 +3780,31 @@
#endif
)
{
- /* Get path of file, replace home dir with ~ */
+ // Get path of file, replace home dir with ~
off = (int)STRLEN(buf);
buf[off++] = ' ';
buf[off++] = '(';
home_replace(curbuf, curbuf->b_ffname,
buf + off, SPACE_FOR_DIR - off, TRUE);
#ifdef BACKSLASH_IN_FILENAME
- /* avoid "c:/name" to be reduced to "c" */
+ // avoid "c:/name" to be reduced to "c"
if (isalpha(buf[off]) && buf[off + 1] == ':')
off += 2;
#endif
- /* remove the file name */
+ // remove the file name
p = gettail_sep(buf + off);
if (p == buf + off)
{
- /* must be a help buffer */
+ // must be a help buffer
vim_strncpy(buf + off, (char_u *)_("help"),
(size_t)(SPACE_FOR_DIR - off - 1));
}
else
*p = NUL;
- /* Translate unprintable chars and concatenate. Keep some
- * room for the server name. When there is no room (very long
- * file name) use (...). */
+ // Translate unprintable chars and concatenate. Keep some
+ // room for the server name. When there is no room (very long
+ // file name) use (...).
if (off < SPACE_FOR_DIR)
{
p = transstr(buf + off);
@@ -3834,7 +3833,7 @@
if (maxlen > 0)
{
- /* make it shorter by removing a bit in the middle */
+ // make it shorter by removing a bit in the middle
if (vim_strsize(buf) > maxlen)
trunc_string(buf, buf, maxlen, IOSIZE);
}
@@ -3873,10 +3872,10 @@
{
if (buf_spname(curbuf) != NULL)
p = buf_spname(curbuf);
- else /* use file name only in icon */
+ else // use file name only in icon
p = gettail(curbuf->b_ffname);
*icon_str = NUL;
- /* Truncate name at 100 bytes. */
+ // Truncate name at 100 bytes.
len = (int)STRLEN(p);
if (len > 100)
{
@@ -3941,7 +3940,7 @@
}
# endif
-#endif /* FEAT_TITLE */
+#endif // FEAT_TITLE
#if defined(FEAT_STL_OPT) || defined(FEAT_GUI_TABLINE) || defined(PROTO)
/*
@@ -3961,14 +3960,14 @@
int
build_stl_str_hl(
win_T *wp,
- char_u *out, /* buffer to write into != NameBuff */
- size_t outlen, /* length of out[] */
+ char_u *out, // buffer to write into != NameBuff
+ size_t outlen, // length of out[]
char_u *fmt,
- int use_sandbox UNUSED, /* "fmt" was set insecurely, use sandbox */
+ int use_sandbox UNUSED, // "fmt" was set insecurely, use sandbox
int fillchar,
int maxwidth,
- struct stl_hlrec *hltab, /* return: HL attributes (can be NULL) */
- struct stl_hlrec *tabtab) /* return: tab page nrs (can be NULL) */
+ struct stl_hlrec *hltab, // return: HL attributes (can be NULL)
+ struct stl_hlrec *tabtab) // return: tab page nrs (can be NULL)
{
linenr_T lnum;
size_t len;
@@ -4050,7 +4049,7 @@
if (fillchar == 0)
fillchar = ' ';
- /* Can't handle a multi-byte fill character yet. */
+ // Can't handle a multi-byte fill character yet.
else if (mb_char2len(fillchar) > 1)
fillchar = '-';
@@ -4091,8 +4090,8 @@
{
if (curitem == STL_MAX_ITEM)
{
- /* There are too many items. Add the error code to the statusline
- * to give the user a hint about what went wrong. */
+ // There are too many items. Add the error code to the statusline
+ // to give the user a hint about what went wrong.
if (p + 6 < out + outlen)
{
mch_memmove(p, " E541", (size_t)5);
@@ -4116,7 +4115,7 @@
* Handle one '%' item.
*/
s++;
- if (*s == NUL) /* ignore trailing % */
+ if (*s == NUL) // ignore trailing %
break;
if (*s == '%')
{
@@ -4155,8 +4154,8 @@
if (curitem > groupitem[groupdepth] + 1
&& item[groupitem[groupdepth]].minwid == 0)
{
- /* remove group if all items are empty and highlight group
- * doesn't change */
+ // remove group if all items are empty and highlight group
+ // doesn't change
group_start_userhl = group_end_userhl = 0;
for (n = groupitem[groupdepth] - 1; n >= 0; n--)
{
@@ -4181,10 +4180,10 @@
}
if (l > item[groupitem[groupdepth]].maxwid)
{
- /* truncate, remove n bytes of text at the start */
+ // truncate, remove n bytes of text at the start
if (has_mbyte)
{
- /* Find the first character that should be included. */
+ // Find the first character that should be included.
n = 0;
while (l >= item[groupitem[groupdepth]].maxwid)
{
@@ -4203,7 +4202,7 @@
while (++l < item[groupitem[groupdepth]].minwid)
*p++ = fillchar;
- /* correct the start of the items for the truncation */
+ // correct the start of the items for the truncation
for (l = groupitem[groupdepth] + 1; l < curitem; l++)
{
item[l].start -= n;
@@ -4213,18 +4212,18 @@
}
else if (abs(item[groupitem[groupdepth]].minwid) > l)
{
- /* fill */
+ // fill
n = item[groupitem[groupdepth]].minwid;
if (n < 0)
{
- /* fill by appending characters */
+ // fill by appending characters
n = 0 - n;
while (l++ < n && p + 1 < out + outlen)
*p++ = fillchar;
}
else
{
- /* fill by inserting characters */
+ // fill by inserting characters
mch_memmove(t + n - l, t, (size_t)(p - t));
l = n - l;
if (p + l >= out + outlen)
@@ -4255,7 +4254,7 @@
if (VIM_ISDIGIT(*s))
{
minwid = (int)getdigits(&s);
- if (minwid < 0) /* overflow */
+ if (minwid < 0) // overflow
minwid = 0;
}
if (*s == STL_USER_HL)
@@ -4273,8 +4272,8 @@
{
if (minwid == 0)
{
- /* %X ends the close label, go back to the previously
- * define tab label nr. */
+ // %X ends the close label, go back to the previously
+ // define tab label nr.
for (n = curitem - 1; n >= 0; --n)
if (item[n].type == TabPage && item[n].minwid >= 0)
{
@@ -4283,7 +4282,7 @@
}
}
else
- /* close nrs are stored as negative values */
+ // close nrs are stored as negative values
minwid = - minwid;
}
item[curitem].type = TabPage;
@@ -4299,7 +4298,7 @@
if (VIM_ISDIGIT(*s))
{
maxwid = (int)getdigits(&s);
- if (maxwid <= 0) /* overflow */
+ if (maxwid <= 0) // overflow
maxwid = 50;
}
}
@@ -4322,7 +4321,7 @@
}
opt = *s++;
- /* OK - now for the real work */
+ // OK - now for the real work
base = 'D';
itemisflag = FALSE;
fillable = TRUE;
@@ -4333,7 +4332,7 @@
case STL_FILEPATH:
case STL_FULLPATH:
case STL_FILENAME:
- fillable = FALSE; /* don't change ' ' to fillchar */
+ fillable = FALSE; // don't change ' ' to fillchar
if (buf_spname(wp->w_buffer) != NULL)
vim_strncpy(NameBuff, buf_spname(wp->w_buffer), MAXPATHL - 1);
else
@@ -4349,12 +4348,12 @@
str = gettail(NameBuff);
break;
- case STL_VIM_EXPR: /* '{' */
+ case STL_VIM_EXPR: // '{'
itemisflag = TRUE;
t = p;
while (*s != '}' && *s != NUL && p + 1 < out + outlen)
*p++ = *s++;
- if (*s != '}') /* missing '}' or out of space */
+ if (*s != '}') // missing '}' or out of space
break;
s++;
*p = 0;
@@ -4412,7 +4411,7 @@
case STL_VIRTCOL:
case STL_VIRTCOL_ALT:
- /* In list mode virtcol needs to be recomputed */
+ // In list mode virtcol needs to be recomputed
virtcol = wp->w_virtcol;
if (wp->w_p_list && lcs_tab1 == NUL)
{
@@ -4421,7 +4420,7 @@
wp->w_p_list = TRUE;
}
++virtcol;
- /* Don't display %V if it's the same as %c. */
+ // Don't display %V if it's the same as %c.
if (opt == STL_VIRTCOL_ALT
&& (virtcol == (colnr_T)(!(State & INSERT) && empty_line
? 0 : (int)wp->w_cursor.col + 1)))
@@ -4465,7 +4464,7 @@
case STL_OFFSET_X:
base = 'X';
- /* FALLTHROUGH */
+ // FALLTHROUGH
case STL_OFFSET:
#ifdef FEAT_BYTEOFF
l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL);
@@ -4477,7 +4476,7 @@
case STL_BYTEVAL_X:
base = 'X';
- /* FALLTHROUGH */
+ // FALLTHROUGH
case STL_BYTEVAL:
num = byteval;
if (num == NL)
@@ -4607,7 +4606,7 @@
{
for (; l < minwid && p + 1 < out + outlen; l++)
{
- /* Don't put a "-" in front of a digit. */
+ // Don't put a "-" in front of a digit.
if (l + 1 == minwid && fillchar == '-' && VIM_ISDIGIT(*t))
*p++ = ' ';
else
@@ -4620,8 +4619,8 @@
while (*t && p + 1 < out + outlen)
{
*p++ = *t++;
- /* Change a space by fillchar, unless fillchar is '-' and a
- * digit follows. */
+ // Change a space by fillchar, unless fillchar is '-' and a
+ // digit follows.
if (fillable && p[-1] == ' '
&& (!VIM_ISDIGIT(*t) || fillchar != '-'))
p[-1] = fillchar;
@@ -4635,7 +4634,7 @@
char_u nstr[20];
if (p + 20 >= out + outlen)
- break; /* not sufficient space */
+ break; // not sufficient space
prevchar_isitem = TRUE;
t = nstr;
if (opt == STL_VIRTCOL_ALT)
@@ -4679,7 +4678,7 @@
vim_free(str);
if (num >= 0 || (!itemisflag && str && *str))
- prevchar_isflag = FALSE; /* Item not NULL, but not a flag */
+ prevchar_isflag = FALSE; // Item not NULL, but not a flag
curitem++;
}
*p = NUL;
@@ -4693,7 +4692,7 @@
width = vim_strsize(out);
if (maxwidth > 0 && width > maxwidth)
{
- /* Result is too long, must truncate somewhere. */
+ // Result is too long, must truncate somewhere.
l = 0;
if (itemcnt == 0)
s = out;
@@ -4702,13 +4701,13 @@
for ( ; l < itemcnt; l++)
if (item[l].type == Trunc)
{
- /* Truncate at %< item. */
+ // Truncate at %< item.
s = item[l].start;
break;
}
if (l == itemcnt)
{
- /* No %< item, truncate first item. */
+ // No %< item, truncate first item.
s = item[0].start;
l = 0;
}
@@ -4716,7 +4715,7 @@
if (width - vim_strsize(s) >= maxwidth)
{
- /* Truncation mark is beyond max length */
+ // Truncation mark is beyond max length
if (has_mbyte)
{
s = out;
@@ -4728,7 +4727,7 @@
break;
s += (*mb_ptr2len)(s);
}
- /* Fill up for half a double-wide character. */
+ // Fill up for half a double-wide character.
while (++width < maxwidth)
*s++ = fillchar;
}
@@ -4758,7 +4757,7 @@
STRMOVE(s + 1, p);
*s = '<';
- /* Fill up for half a double-wide character. */
+ // Fill up for half a double-wide character.
while (++width < maxwidth)
{
s = s + STRLEN(s);
@@ -4766,7 +4765,7 @@
*s = NUL;
}
- --n; /* count the '<' */
+ --n; // count the '<'
for (; l < itemcnt; l++)
{
if (item[l].start - n >= s)
@@ -4779,7 +4778,7 @@
}
else if (width < maxwidth && STRLEN(out) + maxwidth - width + 1 < outlen)
{
- /* Apply STL_MIDDLE if any */
+ // Apply STL_MIDDLE if any
for (l = 0; l < itemcnt; l++)
if (item[l].type == Middle)
break;
@@ -4795,7 +4794,7 @@
}
}
- /* Store the info about highlighting. */
+ // Store the info about highlighting.
if (hltab != NULL)
{
sp = hltab;
@@ -4812,7 +4811,7 @@
sp->userhl = 0;
}
- /* Store the info about tab pages labels. */
+ // Store the info about tab pages labels.
if (tabtab != NULL)
{
sp = tabtab;
@@ -4829,8 +4828,8 @@
sp->userhl = 0;
}
- /* When inside update_screen we do not want redrawing a stausline, ruler,
- * title, etc. to trigger another redraw, it may cause an endless loop. */
+ // When inside update_screen we do not want redrawing a stausline, ruler,
+ // title, etc. to trigger another redraw, it may cause an endless loop.
if (updating_screen)
{
must_redraw = save_must_redraw;
@@ -4839,7 +4838,7 @@
return width;
}
-#endif /* FEAT_STL_OPT */
+#endif // FEAT_STL_OPT
#if defined(FEAT_STL_OPT) || defined(FEAT_CMDL_INFO) \
|| defined(FEAT_GUI_TABLINE) || defined(PROTO)
@@ -4853,18 +4852,18 @@
char_u *buf,
int buflen)
{
- long above; /* number of lines above window */
- long below; /* number of lines below window */
+ long above; // number of lines above window
+ long below; // number of lines below window
- if (buflen < 3) /* need at least 3 chars for writing */
+ if (buflen < 3) // need at least 3 chars for writing
return;
above = wp->w_topline - 1;
#ifdef FEAT_DIFF
above += diff_check_fill(wp, wp->w_topline) - wp->w_topfill;
if (wp->w_topline == 1 && wp->w_topfill >= 1)
- above = 0; /* All buffer lines are displayed and there is an
- * indication of filler lines, that can be considered
- * seeing all lines. */
+ above = 0; // All buffer lines are displayed and there is an
+ // indication of filler lines, that can be considered
+ // seeing all lines.
#endif
below = wp->w_buffer->b_ml.ml_line_count - wp->w_botline + 1;
if (below <= 0)
@@ -4888,15 +4887,15 @@
win_T *wp,
char_u *buf,
int buflen,
- int add_file) /* Add "file" before the arg number */
+ int add_file) // Add "file" before the arg number
{
char_u *p;
- if (ARGCOUNT <= 1) /* nothing to do */
+ if (ARGCOUNT <= 1) // nothing to do
return FALSE;
- p = buf + STRLEN(buf); /* go to the end of the buffer */
- if (p - buf + 35 >= buflen) /* getting too long */
+ p = buf + STRLEN(buf); // go to the end of the buffer
+ if (p - buf + 35 >= buflen) // getting too long
return FALSE;
*p++ = ' ';
*p++ = '(';
@@ -4945,7 +4944,7 @@
# ifdef USE_FNAME_CASE
if (fname != NULL)
- fname_case(fname, 0); /* set correct case for file name */
+ fname_case(fname, 0); // set correct case for file name
# endif
return fname;
@@ -5001,15 +5000,15 @@
int p_ea_save;
int open_wins = 0;
int r;
- int count; /* Maximum number of windows to open. */
- int all; /* When TRUE also load inactive buffers. */
+ int count; // Maximum number of windows to open.
+ int all; // When TRUE also load inactive buffers.
int had_tab = cmdmod.tab;
tabpage_T *tpnext;
- if (eap->addr_count == 0) /* make as many windows as possible */
+ if (eap->addr_count == 0) // make as many windows as possible
count = 9999;
else
- count = eap->line2; /* make as many windows as specified */
+ count = eap->line2; // make as many windows as specified
if (eap->cmdidx == CMD_unhide || eap->cmdidx == CMD_sunhide)
all = FALSE;
else
@@ -5042,16 +5041,16 @@
&& !(wp->w_closing || wp->w_buffer->b_locked > 0))
{
win_close(wp, FALSE);
- wpnext = firstwin; /* just in case an autocommand does
- something strange with windows */
- tpnext = first_tabpage; /* start all over... */
+ wpnext = firstwin; // just in case an autocommand does
+ // something strange with windows
+ tpnext = first_tabpage; // start all over...
open_wins = 0;
}
else
++open_wins;
}
- /* Without the ":tab" modifier only do the current tab page. */
+ // Without the ":tab" modifier only do the current tab page.
if (had_tab == 0 || tpnext == NULL)
break;
goto_tabpage_tp(tpnext, TRUE, TRUE);
@@ -5062,31 +5061,31 @@
* open one. Otherwise move the window to the right position.
* Watch out for autocommands that delete buffers or windows!
*/
- /* Don't execute Win/Buf Enter/Leave autocommands here. */
+ // Don't execute Win/Buf Enter/Leave autocommands here.
++autocmd_no_enter;
win_enter(lastwin, FALSE);
++autocmd_no_leave;
for (buf = firstbuf; buf != NULL && open_wins < count; buf = buf->b_next)
{
- /* Check if this buffer needs a window */
+ // Check if this buffer needs a window
if ((!all && buf->b_ml.ml_mfp == NULL) || !buf->b_p_bl)
continue;
if (had_tab != 0)
{
- /* With the ":tab" modifier don't move the window. */
+ // With the ":tab" modifier don't move the window.
if (buf->b_nwindows > 0)
- wp = lastwin; /* buffer has a window, skip it */
+ wp = lastwin; // buffer has a window, skip it
else
wp = NULL;
}
else
{
- /* Check if this buffer already has a window */
+ // Check if this buffer already has a window
FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf)
break;
- /* If the buffer already has a window, move it */
+ // If the buffer already has a window, move it
if (wp != NULL)
win_move_after(wp, curwin);
}
@@ -5097,21 +5096,21 @@
set_bufref(&bufref, buf);
- /* Split the window and put the buffer in it */
+ // Split the window and put the buffer in it
p_ea_save = p_ea;
- p_ea = TRUE; /* use space from all windows */
+ p_ea = TRUE; // use space from all windows
split_ret = win_split(0, WSP_ROOM | WSP_BELOW);
++open_wins;
p_ea = p_ea_save;
if (split_ret == FAIL)
continue;
- /* Open the buffer in this window. */
+ // Open the buffer in this window.
swap_exists_action = SEA_DIALOG;
set_curbuf(buf, DOBUF_GOTO);
if (!bufref_valid(&bufref))
{
- /* autocommands deleted the buffer!!! */
+ // autocommands deleted the buffer!!!
swap_exists_action = SEA_NONE;
break;
}
@@ -5120,21 +5119,21 @@
#if defined(FEAT_EVAL)
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);
#endif
- /* User selected Quit at ATTENTION prompt; close this window. */
+ // User selected Quit at ATTENTION prompt; close this window.
win_close(curwin, TRUE);
--open_wins;
swap_exists_action = SEA_NONE;
swap_exists_did_quit = TRUE;
#if defined(FEAT_EVAL)
- /* 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);
#endif
}
@@ -5145,20 +5144,20 @@
ui_breakcheck();
if (got_int)
{
- (void)vgetc(); /* only break the file loading, not the rest */
+ (void)vgetc(); // only break the file loading, not the rest
break;
}
#ifdef FEAT_EVAL
- /* Autocommands deleted the buffer or aborted script processing!!! */
+ // Autocommands deleted the buffer or aborted script processing!!!
if (aborting())
break;
#endif
- /* When ":tab" was used open a new tab for a new window repeatedly. */
+ // When ":tab" was used open a new tab for a new window repeatedly.
if (had_tab > 0 && tabpage_index(NULL) <= p_tpm)
cmdmod.tab = 9999;
}
--autocmd_no_enter;
- win_enter(firstwin, FALSE); /* back to first window */
+ win_enter(firstwin, FALSE); // back to first window
--autocmd_no_leave;
/*
@@ -5170,7 +5169,7 @@
|| autowrite(wp->w_buffer, FALSE) == OK);
if (!win_valid(wp))
{
- /* BufWrite Autocommands made the window invalid, start over */
+ // BufWrite Autocommands made the window invalid, start over
wp = lastwin;
}
else if (r)
@@ -5210,8 +5209,8 @@
if (!curbuf->b_p_ml || (nmlines = (int)p_mls) == 0)
return;
- /* Disallow recursive entry here. Can happen when executing a modeline
- * triggers an autocommand, which reloads modelines with a ":do". */
+ // Disallow recursive entry here. Can happen when executing a modeline
+ // triggers an autocommand, which reloads modelines with a ":do".
if (entered)
return;
@@ -5228,7 +5227,7 @@
--entered;
}
-#include "version.h" /* for version number */
+#include "version.h" // for version number
/*
* chk_modeline() - check a single line for a mode string
@@ -5237,11 +5236,11 @@
static int
chk_modeline(
linenr_T lnum,
- int flags) /* Same as for do_modelines(). */
+ int flags) // Same as for do_modelines().
{
char_u *s;
char_u *e;
- char_u *linecopy; /* local copy of any modeline found */
+ char_u *linecopy; // local copy of any modeline found
int prev;
int vers;
int end;
@@ -5260,7 +5259,7 @@
if ((prev != -1 && STRNCMP(s, "ex:", (size_t)3) == 0)
|| STRNCMP(s, "vi:", (size_t)3) == 0)
break;
- /* Accept both "vim" and "Vim". */
+ // Accept both "vim" and "Vim".
if ((s[0] == 'v' || s[0] == 'V') && s[1] == 'i' && s[2] == 'm')
{
if (s[3] == '<' || s[3] == '=' || s[3] == '>')
@@ -5284,17 +5283,17 @@
if (*s)
{
- do /* skip over "ex:", "vi:" or "vim:" */
+ do // skip over "ex:", "vi:" or "vim:"
++s;
while (s[-1] != ':');
- s = linecopy = vim_strsave(s); /* copy the line, it will change */
+ s = linecopy = vim_strsave(s); // copy the line, it will change
if (linecopy == NULL)
return FAIL;
save_sourcing_lnum = sourcing_lnum;
save_sourcing_name = sourcing_name;
- sourcing_lnum = lnum; /* prepare for emsg() */
+ sourcing_lnum = lnum; // prepare for emsg()
sourcing_name = (char_u *)"modelines";
end = FALSE;
@@ -5324,14 +5323,14 @@
if (STRNCMP(s, "set ", (size_t)4) == 0
|| STRNCMP(s, "se ", (size_t)3) == 0)
{
- if (*e != ':') /* no terminating ':'? */
+ if (*e != ':') // no terminating ':'?
break;
end = TRUE;
s = vim_strchr(s, ' ') + 1;
}
- *e = NUL; /* truncate the set command */
+ *e = NUL; // truncate the set command
- if (*s != NUL) /* skip over an empty "::" */
+ if (*s != NUL) // skip over an empty "::"
{
int secure_save = secure;
#ifdef FEAT_EVAL
@@ -5350,10 +5349,10 @@
#ifdef FEAT_EVAL
current_sctx = save_current_sctx;
#endif
- if (retval == FAIL) /* stop if error found */
+ if (retval == FAIL) // stop if error found
break;
}
- s = e + 1; /* advance to next part */
+ s = e + 1; // advance to next part
}
sourcing_lnum = save_sourcing_lnum;
@@ -5477,13 +5476,13 @@
int
buf_hide(buf_T *buf)
{
- /* 'bufhidden' overrules 'hidden' and ":hide", check it first */
+ // 'bufhidden' overrules 'hidden' and ":hide", check it first
switch (buf->b_p_bh[0])
{
- case 'u': /* "unload" */
- case 'w': /* "wipe" */
- case 'd': return FALSE; /* "delete" */
- case 'h': return TRUE; /* "hide" */
+ case 'u': // "unload"
+ case 'w': // "wipe"
+ case 'd': return FALSE; // "delete"
+ case 'h': return TRUE; // "hide"
}
return (p_hid || cmdmod.hide);
}
@@ -5509,8 +5508,8 @@
}
#endif
- /* There is no _file_ when 'buftype' is "nofile", b_sfname
- * contains the name as specified by the user. */
+ // There is no _file_ when 'buftype' is "nofile", b_sfname
+ // contains the name as specified by the user.
if (bt_nofilename(buf))
{
#ifdef FEAT_TERMINAL
@@ -5564,19 +5563,19 @@
aco_save_T aco;
exarg_T ea;
- /* Allocate a buffer without putting it in the buffer list. */
+ // Allocate a buffer without putting it in the buffer list.
newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY);
if (newbuf == NULL)
return TRUE;
- /* Force the 'fileencoding' and 'fileformat' to be equal. */
+ // Force the 'fileencoding' and 'fileformat' to be equal.
if (prep_exarg(&ea, buf) == FAIL)
{
wipe_buffer(newbuf, FALSE);
return TRUE;
}
- /* set curwin/curbuf to buf and save a few things */
+ // set curwin/curbuf to buf and save a few things
aucmd_prepbuf(&aco, newbuf);
if (ml_open(curbuf) == OK
@@ -5584,7 +5583,7 @@
(linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM,
&ea, READ_NEW | READ_DUMMY) == OK)
{
- /* compare the two files line by line */
+ // compare the two files line by line
if (buf->b_ml.ml_line_count == curbuf->b_ml.ml_line_count)
{
differ = FALSE;
@@ -5598,10 +5597,10 @@
}
vim_free(ea.cmd);
- /* restore curwin/curbuf and a few other things */
+ // restore curwin/curbuf and a few other things
aucmd_restbuf(&aco);
- if (curbuf != newbuf) /* safety check */
+ if (curbuf != newbuf) // safety check
wipe_buffer(newbuf, FALSE);
return differ;
@@ -5615,12 +5614,12 @@
void
wipe_buffer(
buf_T *buf,
- int aucmd UNUSED) /* When TRUE trigger autocommands. */
+ int aucmd UNUSED) // When TRUE trigger autocommands.
{
if (buf->b_fnum == top_file_num - 1)
--top_file_num;
- if (!aucmd) /* Don't trigger BufDelete autocommands here. */
+ if (!aucmd) // Don't trigger BufDelete autocommands here.
block_autocmds();
close_buffer(NULL, buf, DOBUF_WIPE, FALSE);