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