diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-10-19 17:12:10 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-10-19 17:12:10 +0200 |
commit | ff930cad8a9100eeb04256aab1a14de993c1d7e9 (patch) | |
tree | 087239febd09bb9c435e93dff38972d7a1cb6790 | |
parent | 87ffb5c1a3aa506a1be07af4e794b3753f839dc3 (diff) | |
download | vim-git-ff930cad8a9100eeb04256aab1a14de993c1d7e9.tar.gz |
patch 8.0.1205: it is possible to unload a changed bufferv8.0.1205
Problem: Using "1q" it is possible to unload a changed buffer. (Rick Howe)
Solution: Check the right window for changes.
-rw-r--r-- | src/ex_docmd.c | 4 | ||||
-rw-r--r-- | src/testdir/test_edit.vim | 13 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 905cdd4b0..ea6df86ad 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7245,8 +7245,8 @@ ex_quit(exarg_T *eap) */ 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 ((!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/testdir/test_edit.vim b/src/testdir/test_edit.vim index 3fcb8a351..bb3af2710 100644 --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -1373,3 +1373,16 @@ func Test_edit_complete_very_long_name() endif set swapfile& 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 + diff --git a/src/version.c b/src/version.c index da06043d4..5a6c72180 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1205, +/**/ 1204, /**/ 1203, |