diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 22:40:57 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 22:50:54 +0100 |
commit | 04993f220a304efa029d44a74bbfa83a8530ea6e (patch) | |
tree | c5057fc1dbd6ff9add33a5392b2691ea2bcc5974 | |
parent | 2929dbf2233f05f58e094ce4a80fb1320ac6d336 (diff) | |
download | rneovim-04993f220a304efa029d44a74bbfa83a8530ea6e.tar.gz rneovim-04993f220a304efa029d44a74bbfa83a8530ea6e.tar.bz2 rneovim-04993f220a304efa029d44a74bbfa83a8530ea6e.zip |
vim-patch:8.0.1205: it is possible to unload a changed buffer
Problem: Using "1q" it is possible to unload a changed buffer. (Rick Howe)
Solution: Check the right window for changes.
https://github.com/vim/vim/commit/ff930cad8a9100eeb04256aab1a14de993c1d7e9
-rw-r--r-- | src/nvim/ex_docmd.c | 13 | ||||
-rw-r--r-- | src/nvim/testdir/test_edit.vim | 13 |
2 files changed, 19 insertions, 7 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index d79f66ef5f..10a8a1e4dc 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5986,13 +5986,12 @@ static void ex_quit(exarg_T *eap) return; } - /* - * If there are more files or windows we won't exit. - */ - if (check_more(FALSE, eap->forceit) == OK && only_one_window()) - exiting = TRUE; - if ((!buf_hide(curbuf) - && check_changed(curbuf, (p_awa ? CCGD_AW : 0) + // If there are more files or windows we won't exit. + if (check_more(FALSE, eap->forceit) == OK && only_one_window()) { + exiting = true; + } + if ((!buf_hide(wp->w_buffer) + && check_changed(wp->w_buffer, (p_awa ? CCGD_AW : 0) | (eap->forceit ? CCGD_FORCEIT : 0) | CCGD_EXCMD)) || check_more(true, eap->forceit) == FAIL diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim index 1bcd245d01..8f815478c2 100644 --- a/src/nvim/testdir/test_edit.vim +++ b/src/nvim/testdir/test_edit.vim @@ -1310,3 +1310,16 @@ func! Test_edit_rightleft() set norightleft bw! endfunc + +func Test_edit_quit() + edit foo.txt + split + new + call setline(1, 'hello') + 3wincmd w + redraw! + call assert_fails('1q', 'E37:') + bwipe! foo.txt + only +endfunc + |