]> granicus.if.org Git - vim/commitdiff
patch 8.0.1205: it is possible to unload a changed buffer v8.0.1205
authorBram Moolenaar <Bram@vim.org>
Thu, 19 Oct 2017 15:12:10 +0000 (17:12 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 19 Oct 2017 15:12:10 +0000 (17:12 +0200)
Problem:    Using "1q" it is possible to unload a changed buffer. (Rick Howe)
Solution:   Check the right window for changes.

src/ex_docmd.c
src/testdir/test_edit.vim
src/version.c

index 905cdd4b046d670d1fba37f583eaeb6d034dbb87..ea6df86ad0cc5703dfad252310a92f92205c02c6 100644 (file)
@@ -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
index 3fcb8a3518bff869506afd1838889bf13f69d011..bb3af27102e4fc30ce50132208664acfc80bb3f3 100644 (file)
@@ -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
+
index da06043d46b03be4d4c51ed40e27c6120adf144b..5a6c721800257908020659c770814fdd4ba605ed 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1205,
 /**/
     1204,
 /**/