Skip to content

Commit ff930ca

Browse files
committed
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.
1 parent 87ffb5c commit ff930ca

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/ex_docmd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7245,8 +7245,8 @@ ex_quit(exarg_T *eap)
72457245
*/
72467246
if (check_more(FALSE, eap->forceit) == OK && only_one_window())
72477247
exiting = TRUE;
7248-
if ((!buf_hide(curbuf)
7249-
&& check_changed(curbuf, (p_awa ? CCGD_AW : 0)
7248+
if ((!buf_hide(wp->w_buffer)
7249+
&& check_changed(wp->w_buffer, (p_awa ? CCGD_AW : 0)
72507250
| (eap->forceit ? CCGD_FORCEIT : 0)
72517251
| CCGD_EXCMD))
72527252
|| check_more(TRUE, eap->forceit) == FAIL

src/testdir/test_edit.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,3 +1373,16 @@ func Test_edit_complete_very_long_name()
13731373
endif
13741374
set swapfile&
13751375
endfunc
1376+
1377+
func Test_edit_quit()
1378+
edit foo.txt
1379+
split
1380+
new
1381+
call setline(1, 'hello')
1382+
3wincmd w
1383+
redraw!
1384+
call assert_fails('1q', 'E37:')
1385+
bwipe! foo.txt
1386+
only
1387+
endfunc
1388+

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1205,
764766
/**/
765767
1204,
766768
/**/

0 commit comments

Comments
 (0)