summaryrefslogtreecommitdiff
path: root/src/testdir/test_quickfix.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-11-11 22:50:27 +0100
committerBram Moolenaar <Bram@vim.org>2018-11-11 22:50:27 +0100
commitb244373becbec124bee20dbbfd05365586cda8cd (patch)
tree469799b11b7a112879bd6b78611d866a6ab029b0 /src/testdir/test_quickfix.vim
parentf3aea59afa23304266dfd0dd26b5d8cc70a21331 (diff)
downloadvim-git-b244373becbec124bee20dbbfd05365586cda8cd.tar.gz
patch 8.1.0523: opening window from quickfix leaves empty buffer behindv8.1.0523
Problem: Opening window from quickfix leaves empty buffer behind. Solution: Add qf_jump_newwin(). (Yegappan Lakshmanan, closes #2574)
Diffstat (limited to 'src/testdir/test_quickfix.vim')
-rw-r--r--src/testdir/test_quickfix.vim46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index b779e2806..be03b41e0 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -3718,3 +3718,49 @@ func Test_curswant()
call assert_equal(getcurpos()[4], virtcol('.'))
cclose | helpclose
endfunc
+
+" Test for opening a file from the quickfix window using CTRL-W <Enter>
+" doesn't leave an empty buffer around.
+func Test_splitview()
+ call s:create_test_file('Xtestfile1')
+ call s:create_test_file('Xtestfile2')
+ new | only
+ let last_bufnr = bufnr('Test_sv_1', 1)
+ let l = ['Xtestfile1:2:Line2', 'Xtestfile2:4:Line4']
+ cgetexpr l
+ copen
+ let numbufs = len(getbufinfo())
+ exe "normal \<C-W>\<CR>"
+ copen
+ exe "normal j\<C-W>\<CR>"
+ " Make sure new empty buffers are not created
+ call assert_equal(numbufs, len(getbufinfo()))
+ " Creating a new buffer should use the next available buffer number
+ call assert_equal(last_bufnr + 4, bufnr("Test_sv_2", 1))
+ bwipe Test_sv_1
+ bwipe Test_sv_2
+ new | only
+
+ " When split opening files from location list window, make sure that two
+ " windows doesn't refer to the same location list
+ lgetexpr l
+ let locid = getloclist(0, {'id' : 0}).id
+ lopen
+ exe "normal \<C-W>\<CR>"
+ call assert_notequal(locid, getloclist(0, {'id' : 0}).id)
+ call assert_equal(0, getloclist(0, {'winid' : 0}).winid)
+ new | only
+
+ " When split opening files from a helpgrep location list window, a new help
+ " window should be opend with a copy of the location list.
+ lhelpgrep window
+ let locid = getloclist(0, {'id' : 0}).id
+ lwindow
+ exe "normal j\<C-W>\<CR>"
+ call assert_notequal(locid, getloclist(0, {'id' : 0}).id)
+ call assert_equal(0, getloclist(0, {'winid' : 0}).winid)
+ new | only
+
+ call delete('Xtestfile1')
+ call delete('Xtestfile2')
+endfunc