mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.1204: a QuitPre autocommand may get the wrong file name
Problem: A QuitPre autocommand may get the wrong file name.
Solution: Pass the buffer being closed to apply_autocmds(). (Rich Howe)
87ffb5c1a3
This commit is contained in:
parent
b5acf6e0c1
commit
070f8df4dd
@ -5974,16 +5974,18 @@ static void ex_quit(exarg_T *eap)
|
||||
wp = curwin;
|
||||
}
|
||||
|
||||
apply_autocmds(EVENT_QUITPRE, NULL, NULL, false, curbuf);
|
||||
// Refuse to quit when locked.
|
||||
if (curbuf_locked()) {
|
||||
return;
|
||||
}
|
||||
apply_autocmds(EVENT_QUITPRE, NULL, NULL, false, wp->w_buffer);
|
||||
// Refuse to quit when locked or when the buffer in the last window is
|
||||
// being closed (can only happen in autocommands).
|
||||
if (curbuf_locked()
|
||||
|| !win_valid(wp)
|
||||
if (!win_valid(wp)
|
||||
|| (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If there are more files or windows we won't exit.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user