aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c1
-rw-r--r--src/nvim/testdir/test_quickfix.vim14
2 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 9a58529736..703a89d31f 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1868,6 +1868,7 @@ bool curbuf_reusable(void)
&& curbuf->b_ffname == NULL
&& curbuf->b_nwindows <= 1
&& (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY())
+ && !bt_quickfix(curbuf)
&& !curbufIsChanged());
}
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index cb3e7ca8f6..6227095f4f 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -2664,3 +2664,17 @@ func Test_qfwin_pos()
call assert_equal(3, winnr())
close
endfunc
+
+" Test to make sure that an empty quickfix buffer is not reused for loading
+" a normal buffer.
+func Test_empty_qfbuf()
+ enew | only
+ call writefile(["Test"], 'Xfile1')
+ call setqflist([], 'f')
+ copen | only
+ let qfbuf = bufnr('')
+ edit Xfile1
+ call assert_notequal(qfbuf, bufnr(''))
+ enew
+ call delete('Xfile1')
+endfunc