1
0
forked from aniani/vim

patch 8.1.0877: new buffer used every time the quickfix window is opened

Problem:    New buffer used every time the quickfix window is opened.
Solution:   Reuse the buffer. (Yegappan Lakshmanan, closes #3902)
This commit is contained in:
Bram Moolenaar
2019-02-05 21:23:04 +01:00
parent 2a78b7c704
commit ee8188fc74
5 changed files with 110 additions and 33 deletions

View File

@@ -3899,3 +3899,46 @@ func Test_viscol()
set efm&
call delete('Xfile1')
endfunc
" Test for the quickfix window buffer
func Xqfbuf_test(cchar)
call s:setup_commands(a:cchar)
" Quickfix buffer should be reused across closing and opening a quickfix
" window
Xexpr "F1:10:Line10"
Xopen
let qfbnum = bufnr('')
Xclose
" Even after the quickfix window is closed, the buffer should be loaded
call assert_true(bufloaded(qfbnum))
Xopen
" Buffer should be reused when opening the window again
call assert_equal(qfbnum, bufnr(''))
Xclose
if a:cchar == 'l'
%bwipe
" For a location list, when both the file window and the location list
" window for the list are closed, then the buffer should be freed.
new | only
lexpr "F1:10:Line10"
let wid = win_getid()
lopen
let qfbnum = bufnr('')
call assert_match(qfbnum . ' %a- "\[Location List]"', execute('ls'))
close
" When the location list window is closed, the buffer name should not
" change to 'Quickfix List'
call assert_match(qfbnum . ' h- "\[Location List]"', execute('ls'))
call assert_true(bufloaded(qfbnum))
new | only
call assert_false(bufloaded(qfbnum))
endif
endfunc
func Test_qfbuf()
call Xqfbuf_test('c')
call Xqfbuf_test('l')
endfunc