1
0
forked from aniani/vim

patch 8.1.0523: opening window from quickfix leaves empty buffer behind

Problem:    Opening window from quickfix leaves empty buffer behind.
Solution:   Add qf_jump_newwin(). (Yegappan Lakshmanan, closes #2574)
This commit is contained in:
Bram Moolenaar
2018-11-11 22:50:27 +01:00
parent f3aea59afa
commit b244373bec
4 changed files with 107 additions and 31 deletions

View File

@@ -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