mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 7.4.1037
Problem: Using "q!" when there is a modified hidden buffer does not unload the current buffer, resulting in the need to abandon it again. Solution: When using "q!" unload the current buffer when needed. (Yasuhiro Matsumoto, Hirohito Higashi)
This commit is contained in:
@@ -1105,10 +1105,10 @@ The names can be in upper- or lowercase.
|
|||||||
the last file in the argument list has not been
|
the last file in the argument list has not been
|
||||||
edited. See |:confirm| and 'confirm'. {not in Vi}
|
edited. See |:confirm| and 'confirm'. {not in Vi}
|
||||||
|
|
||||||
:q[uit]! Quit without writing, also when currently visible
|
:q[uit]! Quit without writing, also when currentl buffer has
|
||||||
buffers have changes. Does not exit when this is the
|
changes. If this is the last window and there is a
|
||||||
last window and there is a changed hidden buffer.
|
modified hidden buffer, the current buffer is
|
||||||
In this case, the first changed hidden buffer becomes
|
abandoned and the first changed hidden buffer becomes
|
||||||
the current buffer.
|
the current buffer.
|
||||||
Use ":qall!" to exit always.
|
Use ":qall!" to exit always.
|
||||||
|
|
||||||
|
@@ -1636,10 +1636,13 @@ add_bufnum(bufnrs, bufnump, nr)
|
|||||||
/*
|
/*
|
||||||
* Return TRUE if any buffer was changed and cannot be abandoned.
|
* Return TRUE if any buffer was changed and cannot be abandoned.
|
||||||
* That changed buffer becomes the current buffer.
|
* That changed buffer becomes the current buffer.
|
||||||
|
* When "unload" is true the current buffer is unloaded instead of making it
|
||||||
|
* hidden. This is used for ":q!".
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
check_changed_any(hidden)
|
check_changed_any(hidden, unload)
|
||||||
int hidden; /* Only check hidden buffers */
|
int hidden; /* Only check hidden buffers */
|
||||||
|
int unload;
|
||||||
{
|
{
|
||||||
int ret = FALSE;
|
int ret = FALSE;
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
@@ -1750,7 +1753,7 @@ buf_found:
|
|||||||
|
|
||||||
/* Open the changed buffer in the current window. */
|
/* Open the changed buffer in the current window. */
|
||||||
if (buf != curbuf)
|
if (buf != curbuf)
|
||||||
set_curbuf(buf, DOBUF_GOTO);
|
set_curbuf(buf, unload ? DOBUF_UNLOAD : DOBUF_GOTO);
|
||||||
|
|
||||||
theend:
|
theend:
|
||||||
vim_free(bufnrs);
|
vim_free(bufnrs);
|
||||||
|
@@ -7143,7 +7143,7 @@ ex_quit(eap)
|
|||||||
| (eap->forceit ? CCGD_FORCEIT : 0)
|
| (eap->forceit ? CCGD_FORCEIT : 0)
|
||||||
| CCGD_EXCMD))
|
| CCGD_EXCMD))
|
||||||
|| check_more(TRUE, eap->forceit) == FAIL
|
|| check_more(TRUE, eap->forceit) == FAIL
|
||||||
|| (only_one_window() && check_changed_any(eap->forceit)))
|
|| (only_one_window() && check_changed_any(eap->forceit, TRUE)))
|
||||||
{
|
{
|
||||||
not_exiting();
|
not_exiting();
|
||||||
}
|
}
|
||||||
@@ -7214,7 +7214,7 @@ ex_quit_all(eap)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
exiting = TRUE;
|
exiting = TRUE;
|
||||||
if (eap->forceit || !check_changed_any(FALSE))
|
if (eap->forceit || !check_changed_any(FALSE, FALSE))
|
||||||
getout(0);
|
getout(0);
|
||||||
not_exiting();
|
not_exiting();
|
||||||
}
|
}
|
||||||
@@ -7609,7 +7609,7 @@ ex_exit(eap)
|
|||||||
|| curbufIsChanged())
|
|| curbufIsChanged())
|
||||||
&& do_write(eap) == FAIL)
|
&& do_write(eap) == FAIL)
|
||||||
|| check_more(TRUE, eap->forceit) == FAIL
|
|| check_more(TRUE, eap->forceit) == FAIL
|
||||||
|| (only_one_window() && check_changed_any(eap->forceit)))
|
|| (only_one_window() && check_changed_any(eap->forceit, FALSE)))
|
||||||
{
|
{
|
||||||
not_exiting();
|
not_exiting();
|
||||||
}
|
}
|
||||||
|
@@ -825,7 +825,7 @@ gui_shell_closed()
|
|||||||
# endif
|
# endif
|
||||||
/* If there are changed buffers, present the user with a dialog if
|
/* If there are changed buffers, present the user with a dialog if
|
||||||
* possible, otherwise give an error message. */
|
* possible, otherwise give an error message. */
|
||||||
if (!check_changed_any(FALSE))
|
if (!check_changed_any(FALSE, FALSE))
|
||||||
getout(0);
|
getout(0);
|
||||||
|
|
||||||
exiting = FALSE;
|
exiting = FALSE;
|
||||||
|
@@ -2003,7 +2003,7 @@ sm_client_check_changed_any(GnomeClient *client UNUSED,
|
|||||||
* If there are changed buffers, present the user with
|
* If there are changed buffers, present the user with
|
||||||
* a dialog if possible, otherwise give an error message.
|
* a dialog if possible, otherwise give an error message.
|
||||||
*/
|
*/
|
||||||
shutdown_cancelled = check_changed_any(FALSE);
|
shutdown_cancelled = check_changed_any(FALSE, FALSE);
|
||||||
|
|
||||||
exiting = FALSE;
|
exiting = FALSE;
|
||||||
cmdmod = save_cmdmod;
|
cmdmod = save_cmdmod;
|
||||||
|
@@ -7132,7 +7132,7 @@ xsmp_handle_interaction(smc_conn, client_data)
|
|||||||
|
|
||||||
save_cmdmod = cmdmod;
|
save_cmdmod = cmdmod;
|
||||||
cmdmod.confirm = TRUE;
|
cmdmod.confirm = TRUE;
|
||||||
if (check_changed_any(FALSE))
|
if (check_changed_any(FALSE, FALSE))
|
||||||
/* Mustn't logout */
|
/* Mustn't logout */
|
||||||
cancel_shutdown = True;
|
cancel_shutdown = True;
|
||||||
cmdmod = save_cmdmod;
|
cmdmod = save_cmdmod;
|
||||||
|
@@ -39,7 +39,7 @@ int check_changed __ARGS((buf_T *buf, int flags));
|
|||||||
void browse_save_fname __ARGS((buf_T *buf));
|
void browse_save_fname __ARGS((buf_T *buf));
|
||||||
void dialog_changed __ARGS((buf_T *buf, int checkall));
|
void dialog_changed __ARGS((buf_T *buf, int checkall));
|
||||||
int can_abandon __ARGS((buf_T *buf, int forceit));
|
int can_abandon __ARGS((buf_T *buf, int forceit));
|
||||||
int check_changed_any __ARGS((int hidden));
|
int check_changed_any __ARGS((int hidden, int unload));
|
||||||
int check_fname __ARGS((void));
|
int check_fname __ARGS((void));
|
||||||
int buf_write_all __ARGS((buf_T *buf, int forceit));
|
int buf_write_all __ARGS((buf_T *buf, int forceit));
|
||||||
int get_arglist __ARGS((garray_T *gap, char_u *str));
|
int get_arglist __ARGS((garray_T *gap, char_u *str));
|
||||||
|
@@ -69,6 +69,26 @@ A 3:close!
|
|||||||
GA 4:all!
|
GA 4:all!
|
||||||
:1wincmd w
|
:1wincmd w
|
||||||
:w >>test.out
|
:w >>test.out
|
||||||
|
:"
|
||||||
|
:" test ":q!" and hidden buffer.
|
||||||
|
:bw! Xtest1 Xtest2 Xtest3 Xtest4
|
||||||
|
:sp Xtest1
|
||||||
|
:wincmd w
|
||||||
|
:bw!
|
||||||
|
:set modified
|
||||||
|
:bot sp Xtest2
|
||||||
|
:set modified
|
||||||
|
:bot sp Xtest3
|
||||||
|
:set modified
|
||||||
|
:wincmd t
|
||||||
|
:hide
|
||||||
|
:q!
|
||||||
|
:w >>test.out
|
||||||
|
:q!
|
||||||
|
:w >>test.out
|
||||||
|
:q!
|
||||||
|
:call append(line('$'), "Oh, Not finished yet.")
|
||||||
|
:w >>test.out
|
||||||
:qa!
|
:qa!
|
||||||
ENDTEST
|
ENDTEST
|
||||||
|
|
||||||
|
@@ -10,3 +10,5 @@ testtext 1
|
|||||||
testtext 3 3 3
|
testtext 3 3 3
|
||||||
testtext 1
|
testtext 1
|
||||||
testtext 2 2 2
|
testtext 2 2 2
|
||||||
|
testtext 3
|
||||||
|
testtext 1
|
||||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1037,
|
||||||
/**/
|
/**/
|
||||||
1036,
|
1036,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user