mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
lint
This commit is contained in:
parent
c68d89521f
commit
7da4d1561b
@ -1407,16 +1407,20 @@ void set_curbuf(buf_T *buf, int action)
|
||||
}
|
||||
if (bufref_valid(&prevbufref) && !aborting()) {
|
||||
win_T *previouswin = curwin;
|
||||
if (prevbuf == curbuf)
|
||||
u_sync(FALSE);
|
||||
close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, prevbuf,
|
||||
unload ? action : (action == DOBUF_GOTO
|
||||
&& !buf_hide(prevbuf)
|
||||
&& !bufIsChanged(
|
||||
prevbuf)) ? DOBUF_UNLOAD : 0, FALSE);
|
||||
if (curwin != previouswin && win_valid(previouswin))
|
||||
/* autocommands changed curwin, Grr! */
|
||||
if (prevbuf == curbuf) {
|
||||
u_sync(false);
|
||||
}
|
||||
close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL,
|
||||
prevbuf,
|
||||
unload
|
||||
? action
|
||||
: (action == DOBUF_GOTO && !buf_hide(prevbuf)
|
||||
&& !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0,
|
||||
false);
|
||||
if (curwin != previouswin && win_valid(previouswin)) {
|
||||
// autocommands changed curwin, Grr!
|
||||
curwin = previouswin;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* An autocommand may have deleted "buf", already entered it (e.g., when
|
||||
@ -4413,7 +4417,7 @@ do_arg_all (
|
||||
}
|
||||
wp->w_arg_idx = i;
|
||||
|
||||
if (i == opened_len && !keep_tabs) { /* close this window */
|
||||
if (i == opened_len && !keep_tabs) { // close this window
|
||||
if (buf_hide(buf) || forceit || buf->b_nwindows > 1
|
||||
|| !bufIsChanged(buf)) {
|
||||
/* If the buffer was changed, and we would like to hide it,
|
||||
@ -4511,14 +4515,15 @@ do_arg_all (
|
||||
new_curwin = curwin;
|
||||
new_curtab = curtab;
|
||||
}
|
||||
(void)do_ecmd(0, alist_name(&AARGLIST(alist)[i]), NULL, NULL,
|
||||
ECMD_ONE,
|
||||
((buf_hide(curwin->w_buffer)
|
||||
|| bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0)
|
||||
+ ECMD_OLDBUF, curwin);
|
||||
if (use_firstwin)
|
||||
++autocmd_no_leave;
|
||||
use_firstwin = FALSE;
|
||||
(void)do_ecmd(0, alist_name(&AARGLIST(alist)[i]), NULL, NULL, ECMD_ONE,
|
||||
((buf_hide(curwin->w_buffer)
|
||||
|| bufIsChanged(curwin->w_buffer))
|
||||
? ECMD_HIDE : 0) + ECMD_OLDBUF,
|
||||
curwin);
|
||||
if (use_firstwin) {
|
||||
autocmd_no_leave++;
|
||||
}
|
||||
use_firstwin = false;
|
||||
}
|
||||
os_breakcheck();
|
||||
|
||||
@ -4706,13 +4711,13 @@ void ex_buffer_all(exarg_T *eap)
|
||||
*/
|
||||
for (wp = lastwin; open_wins > count; ) {
|
||||
r = (buf_hide(wp->w_buffer) || !bufIsChanged(wp->w_buffer)
|
||||
|| autowrite(wp->w_buffer, FALSE) == OK);
|
||||
|| autowrite(wp->w_buffer, false) == OK);
|
||||
if (!win_valid(wp)) {
|
||||
/* BufWrite Autocommands made the window invalid, start over */
|
||||
wp = lastwin;
|
||||
} else if (r) {
|
||||
win_close(wp, !buf_hide(wp->w_buffer));
|
||||
--open_wins;
|
||||
open_wins--;
|
||||
wp = lastwin;
|
||||
} else {
|
||||
wp = wp->w_prev;
|
||||
|
@ -2013,8 +2013,9 @@ int getfile(int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum,
|
||||
} else
|
||||
other = (fnum != curbuf->b_fnum);
|
||||
|
||||
if (other)
|
||||
++no_wait_return; /* don't wait for autowrite message */
|
||||
if (other) {
|
||||
no_wait_return++; // don't wait for autowrite message
|
||||
}
|
||||
if (other && !forceit && curbuf->b_nwindows == 1 && !buf_hide(curbuf)
|
||||
&& curbufIsChanged() && autowrite(curbuf, forceit) == FAIL) {
|
||||
if (p_confirm && p_write)
|
||||
@ -2032,17 +2033,19 @@ int getfile(int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum,
|
||||
if (setpm)
|
||||
setpcmark();
|
||||
if (!other) {
|
||||
if (lnum != 0)
|
||||
if (lnum != 0) {
|
||||
curwin->w_cursor.lnum = lnum;
|
||||
}
|
||||
check_cursor_lnum();
|
||||
beginline(BL_SOL | BL_FIX);
|
||||
retval = 0; /* it's in the same file */
|
||||
retval = 0; // it's in the same file
|
||||
} else if (do_ecmd(fnum, ffname, sfname, NULL, lnum,
|
||||
(buf_hide(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0),
|
||||
curwin) == OK)
|
||||
retval = -1; /* opened another file */
|
||||
else
|
||||
retval = 1; /* error encountered */
|
||||
(buf_hide(curbuf) ? ECMD_HIDE : 0)
|
||||
+ (forceit ? ECMD_FORCEIT : 0), curwin) == OK) {
|
||||
retval = -1; // opened another file
|
||||
} else {
|
||||
retval = 1; // error encountered
|
||||
}
|
||||
|
||||
theend:
|
||||
xfree(free_me);
|
||||
|
@ -5987,7 +5987,7 @@ static void ex_quit(exarg_T *eap)
|
||||
}
|
||||
|
||||
// If there are more files or windows we won't exit.
|
||||
if (check_more(FALSE, eap->forceit) == OK && only_one_window()) {
|
||||
if (check_more(false, eap->forceit) == OK && only_one_window()) {
|
||||
exiting = true;
|
||||
}
|
||||
if ((!buf_hide(wp->w_buffer)
|
||||
@ -6007,7 +6007,7 @@ static void ex_quit(exarg_T *eap)
|
||||
if (only_one_window() && (ONE_WINDOW || eap->addr_count == 0)) {
|
||||
getout(0);
|
||||
}
|
||||
/* close window; may free buffer */
|
||||
// close window; may free buffer
|
||||
win_close(wp, !buf_hide(wp->w_buffer) || eap->forceit);
|
||||
}
|
||||
}
|
||||
@ -6123,11 +6123,12 @@ ex_win_close (
|
||||
}
|
||||
|
||||
|
||||
/* free buffer when not hiding it or when it's a scratch buffer */
|
||||
if (tp == NULL)
|
||||
// free buffer when not hiding it or when it's a scratch buffer
|
||||
if (tp == NULL) {
|
||||
win_close(win, !need_hide && !buf_hide(buf));
|
||||
else
|
||||
} else {
|
||||
win_close_othertab(win, !need_hide && !buf_hide(buf), tp);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -6928,15 +6929,14 @@ do_exedit (
|
||||
empty buffer */
|
||||
setpcmark();
|
||||
if (do_ecmd(0, (eap->cmdidx == CMD_enew ? NULL : eap->arg),
|
||||
NULL, eap,
|
||||
eap->do_ecmd_lnum,
|
||||
(buf_hide(curbuf) ? ECMD_HIDE : 0)
|
||||
+ (eap->forceit ? ECMD_FORCEIT : 0)
|
||||
// After a split we can use an existing buffer.
|
||||
+ (old_curwin != NULL ? ECMD_OLDBUF : 0)
|
||||
+ (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 )
|
||||
, old_curwin == NULL ? curwin : NULL) == FAIL) {
|
||||
/* Editing the file failed. If the window was split, close it. */
|
||||
NULL, eap, eap->do_ecmd_lnum,
|
||||
(buf_hide(curbuf) ? ECMD_HIDE : 0)
|
||||
+ (eap->forceit ? ECMD_FORCEIT : 0)
|
||||
// After a split we can use an existing buffer.
|
||||
+ (old_curwin != NULL ? ECMD_OLDBUF : 0)
|
||||
+ (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0)
|
||||
, old_curwin == NULL ? curwin : NULL) == FAIL) {
|
||||
// Editing the file failed. If the window was split, close it.
|
||||
if (old_curwin != NULL) {
|
||||
need_hide = (curbufIsChanged() && curbuf->b_nwindows <= 1);
|
||||
if (!need_hide || buf_hide(curbuf)) {
|
||||
|
@ -5235,7 +5235,7 @@ static void nv_gotofile(cmdarg_T *cap)
|
||||
}
|
||||
setpcmark();
|
||||
(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,
|
||||
buf_hide(curbuf) ? ECMD_HIDE : 0, curwin);
|
||||
buf_hide(curbuf) ? ECMD_HIDE : 0, curwin);
|
||||
if (cap->nchar == 'F' && lnum >= 0) {
|
||||
curwin->w_cursor.lnum = lnum;
|
||||
check_cursor_lnum();
|
||||
|
Loading…
Reference in New Issue
Block a user