mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 16:08:36 +00:00
Merge pull request #4743 from jamessan/vim-7.4.1037
vim-patch:7.4.1037,fa73534
This commit is contained in:
@@ -1241,16 +1241,18 @@ static void add_bufnum(int *bufnrs, int *bufnump, int nr)
|
||||
*bufnump = *bufnump + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if any buffer was changed and cannot be abandoned.
|
||||
* That changed buffer becomes the current buffer.
|
||||
*/
|
||||
int
|
||||
check_changed_any (
|
||||
int hidden /* Only check hidden buffers */
|
||||
)
|
||||
/// Check if any buffer was changed and cannot be abandoned.
|
||||
/// 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!".
|
||||
///
|
||||
/// @param[in] hidden specifies whether to check only hidden buffers.
|
||||
/// @param[in] unload specifies whether to unload, instead of hide, the buffer.
|
||||
///
|
||||
/// @returns true if any buffer is changed and cannot be abandoned
|
||||
int check_changed_any(bool hidden, bool unload)
|
||||
{
|
||||
int ret = FALSE;
|
||||
bool ret = false;
|
||||
int save;
|
||||
int i;
|
||||
int bufnum = 0;
|
||||
@@ -1261,8 +1263,9 @@ check_changed_any (
|
||||
++bufcount;
|
||||
}
|
||||
|
||||
if (bufcount == 0)
|
||||
return FALSE;
|
||||
if (bufcount == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bufnrs = xmalloc(sizeof(*bufnrs) * bufcount);
|
||||
|
||||
@@ -1346,9 +1349,10 @@ check_changed_any (
|
||||
}
|
||||
buf_found:
|
||||
|
||||
/* Open the changed buffer in the current window. */
|
||||
if (buf != curbuf)
|
||||
set_curbuf(buf, DOBUF_GOTO);
|
||||
// Open the changed buffer in the current window.
|
||||
if (buf != curbuf) {
|
||||
set_curbuf(buf, unload ? DOBUF_UNLOAD : DOBUF_GOTO);
|
||||
}
|
||||
|
||||
theend:
|
||||
xfree(bufnrs);
|
||||
|
@@ -5671,10 +5671,10 @@ static void ex_quit(exarg_T *eap)
|
||||
exiting = TRUE;
|
||||
if ((!P_HID(curbuf)
|
||||
&& check_changed(curbuf, (p_awa ? CCGD_AW : 0)
|
||||
| (eap->forceit ? CCGD_FORCEIT : 0)
|
||||
| CCGD_EXCMD))
|
||||
|| check_more(TRUE, eap->forceit) == FAIL
|
||||
|| (only_one_window() && check_changed_any(eap->forceit))) {
|
||||
| (eap->forceit ? CCGD_FORCEIT : 0)
|
||||
| CCGD_EXCMD))
|
||||
|| check_more(true, eap->forceit) == FAIL
|
||||
|| (only_one_window() && check_changed_any(eap->forceit, true))) {
|
||||
not_exiting();
|
||||
} else {
|
||||
// quit last window
|
||||
@@ -5723,9 +5723,10 @@ static void ex_quit_all(exarg_T *eap)
|
||||
if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_closing))
|
||||
return;
|
||||
|
||||
exiting = TRUE;
|
||||
if (eap->forceit || !check_changed_any(FALSE))
|
||||
exiting = true;
|
||||
if (eap->forceit || !check_changed_any(false, false)) {
|
||||
getout(0);
|
||||
}
|
||||
not_exiting();
|
||||
}
|
||||
|
||||
@@ -6010,21 +6011,22 @@ static void ex_exit(exarg_T *eap)
|
||||
if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_closing))
|
||||
return;
|
||||
|
||||
/*
|
||||
* if more files or windows we won't exit
|
||||
*/
|
||||
if (check_more(FALSE, eap->forceit) == OK && only_one_window())
|
||||
exiting = TRUE;
|
||||
if ( ((eap->cmdidx == CMD_wq
|
||||
|| curbufIsChanged())
|
||||
&& do_write(eap) == FAIL)
|
||||
|| check_more(TRUE, eap->forceit) == FAIL
|
||||
|| (only_one_window() && check_changed_any(eap->forceit))) {
|
||||
// if more files or windows we won't exit
|
||||
if (check_more(false, eap->forceit) == OK && only_one_window()) {
|
||||
exiting = true;
|
||||
}
|
||||
if (((eap->cmdidx == CMD_wq
|
||||
|| curbufIsChanged())
|
||||
&& do_write(eap) == FAIL)
|
||||
|| check_more(true, eap->forceit) == FAIL
|
||||
|| (only_one_window() && check_changed_any(eap->forceit, false))) {
|
||||
not_exiting();
|
||||
} else {
|
||||
if (only_one_window()) /* quit last window, exit Vim */
|
||||
if (only_one_window()) {
|
||||
// quit last window, exit Vim
|
||||
getout(0);
|
||||
/* Quit current window, may free the buffer. */
|
||||
}
|
||||
// Quit current window, may free the buffer.
|
||||
win_close(curwin, !P_HID(curwin->w_buffer));
|
||||
}
|
||||
}
|
||||
|
@@ -645,7 +645,7 @@ static int included_patches[] = {
|
||||
// 1040 NA
|
||||
// 1039,
|
||||
// 1038 NA
|
||||
// 1037,
|
||||
1037,
|
||||
// 1036,
|
||||
1035,
|
||||
// 1034,
|
||||
|
Reference in New Issue
Block a user