aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-02 20:39:48 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-02-11 15:27:57 +0100
commit070f8df4dd0f9202d8ebc412ce267dc9aa7c8e71 (patch)
tree8daaa2fa5bd3016c9a9818e6f7524d87afd34a03 /src
parentb5acf6e0c1aedd68ec3423a45c7bf30599832708 (diff)
downloadrneovim-070f8df4dd0f9202d8ebc412ce267dc9aa7c8e71.tar.gz
rneovim-070f8df4dd0f9202d8ebc412ce267dc9aa7c8e71.tar.bz2
rneovim-070f8df4dd0f9202d8ebc412ce267dc9aa7c8e71.zip
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) https://github.com/vim/vim/commit/87ffb5c1a3aa506a1be07af4e794b3753f839dc3
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_docmd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 34d8546653..bd46c65c15 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -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.
*/