mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
lint
This commit is contained in:
parent
c04ffe866d
commit
e4e7b2d239
@ -1339,7 +1339,7 @@ void do_autochdir(void)
|
|||||||
// functions for dealing with the buffer list
|
// 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.
|
/// Add a file name to the buffer list.
|
||||||
/// If the same file name already exists return a pointer to that buffer.
|
/// If the same file name already exists return a pointer to that buffer.
|
||||||
|
@ -92,7 +92,7 @@ typedef struct {
|
|||||||
linenr_T lnum;
|
linenr_T lnum;
|
||||||
long nmatch;
|
long nmatch;
|
||||||
char_u *line;
|
char_u *line;
|
||||||
kvec_t(colnr_T) cols; //< columns of in-line matches
|
kvec_t(colnr_T) cols; ///< columns of in-line matches
|
||||||
} MatchedLine;
|
} MatchedLine;
|
||||||
typedef kvec_t(MatchedLine) MatchedLineVec;
|
typedef kvec_t(MatchedLine) MatchedLineVec;
|
||||||
|
|
||||||
@ -2060,7 +2060,7 @@ theend:
|
|||||||
/// info of the previous buffer for "oldwin" is stored.
|
/// info of the previous buffer for "oldwin" is stored.
|
||||||
///
|
///
|
||||||
/// @return FAIL for failure, OK otherwise
|
/// @return FAIL for failure, OK otherwise
|
||||||
int do_ecmd (
|
int do_ecmd(
|
||||||
int fnum,
|
int fnum,
|
||||||
char_u *ffname,
|
char_u *ffname,
|
||||||
char_u *sfname,
|
char_u *sfname,
|
||||||
@ -2201,7 +2201,7 @@ int do_ecmd (
|
|||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
buf = buflist_new(ffname, sfname, 0L,
|
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.
|
// Autocmds may change curwin and curbuf.
|
||||||
if (oldwin != NULL) {
|
if (oldwin != NULL) {
|
||||||
oldwin = curwin;
|
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;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!subflags.do_count && !MODIFIABLE(curbuf)) {
|
if (!subflags.do_count && !MODIFIABLE(curbuf)) {
|
||||||
// Substitution is not allowed in non-'modifiable' buffer
|
// Substitution is not allowed in non-'modifiable' buffer
|
||||||
@ -5878,50 +5879,39 @@ static enum
|
|||||||
EXP_SIGN_NAMES /* expand with name of placed signs */
|
EXP_SIGN_NAMES /* expand with name of placed signs */
|
||||||
} expand_what;
|
} expand_what;
|
||||||
|
|
||||||
/*
|
/// Function given to ExpandGeneric() to obtain the sign command
|
||||||
* Function given to ExpandGeneric() to obtain the sign command
|
/// expansion.
|
||||||
* expansion.
|
|
||||||
*/
|
|
||||||
char_u * get_sign_name(expand_T *xp, int idx)
|
char_u * get_sign_name(expand_T *xp, int idx)
|
||||||
{
|
{
|
||||||
sign_T *sp;
|
switch (expand_what)
|
||||||
int current_idx;
|
{
|
||||||
|
|
||||||
switch (expand_what)
|
|
||||||
{
|
|
||||||
case EXP_SUBCMD:
|
case EXP_SUBCMD:
|
||||||
return (char_u *)cmds[idx];
|
return (char_u *)cmds[idx];
|
||||||
case EXP_DEFINE:
|
case EXP_DEFINE: {
|
||||||
{
|
char *define_arg[] = { "icon=", "linehl=", "text=", "texthl=", NULL };
|
||||||
char *define_arg[] =
|
return (char_u *)define_arg[idx];
|
||||||
{
|
}
|
||||||
"icon=", "linehl=", "text=", "texthl=", NULL
|
case EXP_PLACE: {
|
||||||
};
|
char *place_arg[] = { "line=", "name=", "file=", "buffer=", NULL };
|
||||||
return (char_u *)define_arg[idx];
|
return (char_u *)place_arg[idx];
|
||||||
}
|
}
|
||||||
case EXP_PLACE:
|
case EXP_UNPLACE: {
|
||||||
{
|
char *unplace_arg[] = { "file=", "buffer=", NULL };
|
||||||
char *place_arg[] =
|
return (char_u *)unplace_arg[idx];
|
||||||
{
|
}
|
||||||
"line=", "name=", "file=", "buffer=", NULL
|
case EXP_SIGN_NAMES: {
|
||||||
};
|
// Complete with name of signs already defined
|
||||||
return (char_u *)place_arg[idx];
|
int current_idx = 0;
|
||||||
}
|
for (sign_T *sp = first_sign; sp != NULL; sp = sp->sn_next) {
|
||||||
case EXP_UNPLACE:
|
if (current_idx++ == idx) {
|
||||||
{
|
return sp->sn_name;
|
||||||
char *unplace_arg[] = { "file=", "buffer=", NULL };
|
}
|
||||||
return (char_u *)unplace_arg[idx];
|
}
|
||||||
}
|
}
|
||||||
case EXP_SIGN_NAMES:
|
return NULL;
|
||||||
/* Complete with name of signs already defined */
|
|
||||||
current_idx = 0;
|
|
||||||
for (sp = first_sign; sp != NULL; sp = sp->sn_next)
|
|
||||||
if (current_idx++ == idx)
|
|
||||||
return sp->sn_name;
|
|
||||||
return NULL;
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6343,27 +6343,24 @@ aucmd_prepbuf (
|
|||||||
aco->new_curbuf = curbuf;
|
aco->new_curbuf = curbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Cleanup after executing autocommands for a (hidden) buffer.
|
||||||
* Cleanup after executing autocommands for a (hidden) buffer.
|
/// Restore the window as it was (if possible).
|
||||||
* Restore the window as it was (if possible).
|
///
|
||||||
*/
|
/// @param aco structure holding saved values
|
||||||
void
|
void aucmd_restbuf(aco_save_T *aco)
|
||||||
aucmd_restbuf (
|
|
||||||
aco_save_T *aco /* structure holding saved values */
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
int dummy;
|
int dummy;
|
||||||
|
|
||||||
if (aco->use_aucmd_win) {
|
if (aco->use_aucmd_win) {
|
||||||
--curbuf->b_nwindows;
|
curbuf->b_nwindows--;
|
||||||
/* Find "aucmd_win", it can't be closed, but it may be in another tab
|
// Find "aucmd_win", it can't be closed, but it may be in another tab page.
|
||||||
* page. Do not trigger autocommands here. */
|
// Do not trigger autocommands here.
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
if (curwin != aucmd_win) {
|
if (curwin != aucmd_win) {
|
||||||
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
||||||
if (wp == aucmd_win) {
|
if (wp == aucmd_win) {
|
||||||
if (tp != curtab) {
|
if (tp != curtab) {
|
||||||
goto_tabpage_tp(tp, TRUE, TRUE);
|
goto_tabpage_tp(tp, true, true);
|
||||||
}
|
}
|
||||||
win_goto(aucmd_win);
|
win_goto(aucmd_win);
|
||||||
goto win_found;
|
goto win_found;
|
||||||
@ -6372,39 +6369,39 @@ aucmd_restbuf (
|
|||||||
}
|
}
|
||||||
win_found:
|
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);
|
(void)winframe_remove(curwin, &dummy, NULL);
|
||||||
win_remove(curwin, NULL);
|
win_remove(curwin, NULL);
|
||||||
aucmd_win_used = FALSE;
|
aucmd_win_used = false;
|
||||||
last_status(FALSE); /* may need to remove last status line */
|
last_status(false); // may need to remove last status line
|
||||||
restore_snapshot(SNAP_AUCMD_IDX, FALSE);
|
restore_snapshot(SNAP_AUCMD_IDX, false);
|
||||||
(void)win_comp_pos(); /* recompute window positions */
|
(void)win_comp_pos(); // recompute window positions
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
|
|
||||||
if (win_valid(aco->save_curwin))
|
if (win_valid(aco->save_curwin)) {
|
||||||
curwin = aco->save_curwin;
|
curwin = aco->save_curwin;
|
||||||
else
|
} else {
|
||||||
/* Hmm, original window disappeared. Just use the first one. */
|
// Hmm, original window disappeared. Just use the first one.
|
||||||
curwin = firstwin;
|
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;
|
curbuf = curwin->w_buffer;
|
||||||
|
|
||||||
xfree(globaldir);
|
xfree(globaldir);
|
||||||
globaldir = aco->globaldir;
|
globaldir = aco->globaldir;
|
||||||
|
|
||||||
/* the buffer contents may have changed */
|
// the buffer contents may have changed
|
||||||
check_cursor();
|
check_cursor();
|
||||||
if (curwin->w_topline > curbuf->b_ml.ml_line_count) {
|
if (curwin->w_topline > curbuf->b_ml.ml_line_count) {
|
||||||
curwin->w_topline = curbuf->b_ml.ml_line_count;
|
curwin->w_topline = curbuf->b_ml.ml_line_count;
|
||||||
curwin->w_topfill = 0;
|
curwin->w_topfill = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* restore curwin */
|
// restore curwin
|
||||||
if (win_valid(aco->save_curwin)) {
|
if (win_valid(aco->save_curwin)) {
|
||||||
/* Restore the buffer which was previously edited by curwin, if
|
// Restore the buffer which was previously edited by curwin, if it was
|
||||||
* it was changed, we are still the same window and the buffer is
|
// changed, we are still the same window and the buffer is valid.
|
||||||
* valid. */
|
|
||||||
if (curwin == aco->new_curwin
|
if (curwin == aco->new_curwin
|
||||||
&& curbuf != aco->new_curbuf
|
&& curbuf != aco->new_curbuf
|
||||||
&& buf_valid(aco->new_curbuf)
|
&& buf_valid(aco->new_curbuf)
|
||||||
@ -6412,10 +6409,10 @@ win_found:
|
|||||||
if (curwin->w_s == &curbuf->b_s) {
|
if (curwin->w_s == &curbuf->b_s) {
|
||||||
curwin->w_s = &aco->new_curbuf->b_s;
|
curwin->w_s = &aco->new_curbuf->b_s;
|
||||||
}
|
}
|
||||||
--curbuf->b_nwindows;
|
curbuf->b_nwindows--;
|
||||||
curbuf = aco->new_curbuf;
|
curbuf = aco->new_curbuf;
|
||||||
curwin->w_buffer = curbuf;
|
curwin->w_buffer = curbuf;
|
||||||
++curbuf->b_nwindows;
|
curbuf->b_nwindows++;
|
||||||
}
|
}
|
||||||
|
|
||||||
curwin = aco->save_curwin;
|
curwin = aco->save_curwin;
|
||||||
|
@ -2344,8 +2344,8 @@ static void u_undoredo(int undo)
|
|||||||
/// Otherwise, report the number of changes (this may be incorrect
|
/// Otherwise, report the number of changes (this may be incorrect
|
||||||
/// in some cases, but it's better than nothing).
|
/// in some cases, but it's better than nothing).
|
||||||
static void u_undo_end(
|
static void u_undo_end(
|
||||||
int did_undo, //< just did an undo
|
int did_undo, ///< just did an undo
|
||||||
int absolute, //< used ":undo N"
|
int absolute, ///< used ":undo N"
|
||||||
bool quiet)
|
bool quiet)
|
||||||
{
|
{
|
||||||
char *msgstr;
|
char *msgstr;
|
||||||
|
Loading…
Reference in New Issue
Block a user