This commit is contained in:
Justin M. Keyes 2016-11-06 11:23:40 +01:00
parent c04ffe866d
commit e4e7b2d239
4 changed files with 63 additions and 76 deletions

View File

@ -1339,7 +1339,7 @@ void do_autochdir(void)
// functions for dealing with the buffer list
//
static int top_file_num = 1; /* highest file number */
static int top_file_num = 1; ///< highest file number
/// Add a file name to the buffer list.
/// If the same file name already exists return a pointer to that buffer.

View File

@ -92,7 +92,7 @@ typedef struct {
linenr_T lnum;
long nmatch;
char_u *line;
kvec_t(colnr_T) cols; //< columns of in-line matches
kvec_t(colnr_T) cols; ///< columns of in-line matches
} MatchedLine;
typedef kvec_t(MatchedLine) MatchedLineVec;
@ -2060,7 +2060,7 @@ theend:
/// info of the previous buffer for "oldwin" is stored.
///
/// @return FAIL for failure, OK otherwise
int do_ecmd (
int do_ecmd(
int fnum,
char_u *ffname,
char_u *sfname,
@ -2201,7 +2201,7 @@ int do_ecmd (
goto theend;
}
buf = buflist_new(ffname, sfname, 0L,
BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED));
BLN_CURBUF | (flags & ECMD_SET_HELP ? 0 : BLN_LISTED));
// Autocmds may change curwin and curbuf.
if (oldwin != NULL) {
oldwin = curwin;
@ -3264,8 +3264,9 @@ buf_T *do_sub(exarg_T *eap)
}
}
if (eap->skip) /* not executing commands, only parsing */
if (eap->skip) { // not executing commands, only parsing
return NULL;
}
if (!subflags.do_count && !MODIFIABLE(curbuf)) {
// Substitution is not allowed in non-'modifiable' buffer
@ -5878,46 +5879,35 @@ static enum
EXP_SIGN_NAMES /* expand with name of placed signs */
} expand_what;
/*
* Function given to ExpandGeneric() to obtain the sign command
* expansion.
*/
/// Function given to ExpandGeneric() to obtain the sign command
/// expansion.
char_u * get_sign_name(expand_T *xp, int idx)
{
sign_T *sp;
int current_idx;
switch (expand_what)
{
case EXP_SUBCMD:
return (char_u *)cmds[idx];
case EXP_DEFINE:
{
char *define_arg[] =
{
"icon=", "linehl=", "text=", "texthl=", NULL
};
case EXP_DEFINE: {
char *define_arg[] = { "icon=", "linehl=", "text=", "texthl=", NULL };
return (char_u *)define_arg[idx];
}
case EXP_PLACE:
{
char *place_arg[] =
{
"line=", "name=", "file=", "buffer=", NULL
};
case EXP_PLACE: {
char *place_arg[] = { "line=", "name=", "file=", "buffer=", NULL };
return (char_u *)place_arg[idx];
}
case EXP_UNPLACE:
{
case EXP_UNPLACE: {
char *unplace_arg[] = { "file=", "buffer=", NULL };
return (char_u *)unplace_arg[idx];
}
case EXP_SIGN_NAMES:
/* Complete with name of signs already defined */
current_idx = 0;
for (sp = first_sign; sp != NULL; sp = sp->sn_next)
if (current_idx++ == idx)
case EXP_SIGN_NAMES: {
// Complete with name of signs already defined
int current_idx = 0;
for (sign_T *sp = first_sign; sp != NULL; sp = sp->sn_next) {
if (current_idx++ == idx) {
return sp->sn_name;
}
}
}
return NULL;
default:
return NULL;

View File

@ -6343,27 +6343,24 @@ aucmd_prepbuf (
aco->new_curbuf = curbuf;
}
/*
* Cleanup after executing autocommands for a (hidden) buffer.
* Restore the window as it was (if possible).
*/
void
aucmd_restbuf (
aco_save_T *aco /* structure holding saved values */
)
/// Cleanup after executing autocommands for a (hidden) buffer.
/// Restore the window as it was (if possible).
///
/// @param aco structure holding saved values
void aucmd_restbuf(aco_save_T *aco)
{
int dummy;
if (aco->use_aucmd_win) {
--curbuf->b_nwindows;
/* Find "aucmd_win", it can't be closed, but it may be in another tab
* page. Do not trigger autocommands here. */
curbuf->b_nwindows--;
// Find "aucmd_win", it can't be closed, but it may be in another tab page.
// Do not trigger autocommands here.
block_autocmds();
if (curwin != aucmd_win) {
FOR_ALL_TAB_WINDOWS(tp, wp) {
if (wp == aucmd_win) {
if (tp != curtab) {
goto_tabpage_tp(tp, TRUE, TRUE);
goto_tabpage_tp(tp, true, true);
}
win_goto(aucmd_win);
goto win_found;
@ -6372,39 +6369,39 @@ aucmd_restbuf (
}
win_found:
/* Remove the window and frame from the tree of frames. */
// Remove the window and frame from the tree of frames.
(void)winframe_remove(curwin, &dummy, NULL);
win_remove(curwin, NULL);
aucmd_win_used = FALSE;
last_status(FALSE); /* may need to remove last status line */
restore_snapshot(SNAP_AUCMD_IDX, FALSE);
(void)win_comp_pos(); /* recompute window positions */
aucmd_win_used = false;
last_status(false); // may need to remove last status line
restore_snapshot(SNAP_AUCMD_IDX, false);
(void)win_comp_pos(); // recompute window positions
unblock_autocmds();
if (win_valid(aco->save_curwin))
if (win_valid(aco->save_curwin)) {
curwin = aco->save_curwin;
else
/* Hmm, original window disappeared. Just use the first one. */
} else {
// Hmm, original window disappeared. Just use the first one.
curwin = firstwin;
vars_clear(&aucmd_win->w_vars->dv_hashtab); /* free all w: variables */
hash_init(&aucmd_win->w_vars->dv_hashtab); /* re-use the hashtab */
}
vars_clear(&aucmd_win->w_vars->dv_hashtab); // free all w: variables
hash_init(&aucmd_win->w_vars->dv_hashtab); // re-use the hashtab
curbuf = curwin->w_buffer;
xfree(globaldir);
globaldir = aco->globaldir;
/* the buffer contents may have changed */
// the buffer contents may have changed
check_cursor();
if (curwin->w_topline > curbuf->b_ml.ml_line_count) {
curwin->w_topline = curbuf->b_ml.ml_line_count;
curwin->w_topfill = 0;
}
} else {
/* restore curwin */
// restore curwin
if (win_valid(aco->save_curwin)) {
/* Restore the buffer which was previously edited by curwin, if
* it was changed, we are still the same window and the buffer is
* valid. */
// Restore the buffer which was previously edited by curwin, if it was
// changed, we are still the same window and the buffer is valid.
if (curwin == aco->new_curwin
&& curbuf != aco->new_curbuf
&& buf_valid(aco->new_curbuf)
@ -6412,10 +6409,10 @@ win_found:
if (curwin->w_s == &curbuf->b_s) {
curwin->w_s = &aco->new_curbuf->b_s;
}
--curbuf->b_nwindows;
curbuf->b_nwindows--;
curbuf = aco->new_curbuf;
curwin->w_buffer = curbuf;
++curbuf->b_nwindows;
curbuf->b_nwindows++;
}
curwin = aco->save_curwin;

View File

@ -2344,8 +2344,8 @@ static void u_undoredo(int undo)
/// Otherwise, report the number of changes (this may be incorrect
/// in some cases, but it's better than nothing).
static void u_undo_end(
int did_undo, //< just did an undo
int absolute, //< used ":undo N"
int did_undo, ///< just did an undo
int absolute, ///< used ":undo N"
bool quiet)
{
char *msgstr;