aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-10-10 15:22:05 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-10-10 22:04:25 -0400
commit9606317486416aeba590d44fd9fcc955834d1e3b (patch)
tree03759dd403a84d1fef6eae7a537d3d05cd438547 /src/nvim/testdir
parente82b8ddef16eb7ce96e1d3d063ff529f79ed6bb2 (diff)
downloadrneovim-9606317486416aeba590d44fd9fcc955834d1e3b.tar.gz
rneovim-9606317486416aeba590d44fd9fcc955834d1e3b.tar.bz2
rneovim-9606317486416aeba590d44fd9fcc955834d1e3b.zip
vim-patch:8.1.0988: deleting location list buffer breaks location list window
Problem: Deleting a location list buffer breaks location list window functionality. Solution: (Yegappan Lakshmanan, closes vim/vim#4056) https://github.com/vim/vim/commit/d82a81cad93708a6c180e59119db4818cc38c1a9 Cherry-pick Xqbuf_test() changes from patch 8.1.0892. Patch 8.1.0892 triggers a memory leak.
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_quickfix.vim34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index d7eb4806ec..dc1b20ce65 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -4061,8 +4061,40 @@ func Xqfbuf_test(cchar)
call assert_match(qfbnum . ' h- "\[Location List]"', execute('ls'))
call assert_true(bufloaded(qfbnum))
+ " After deleting a location list buffer using ":bdelete", opening the
+ " location list window should mark the buffer as a location list buffer.
+ exe "bdelete " . qfbnum
+ lopen
+ call assert_equal("quickfix", &buftype)
+ call assert_equal(1, getwininfo(win_getid(winnr()))[0].loclist)
+ call assert_equal(wid, getloclist(0, {'filewinid' : 0}).filewinid)
+ call assert_false(&swapfile)
+ lclose
+
+ " When the location list is cleared for the window, the buffer should be
+ " removed
+ call setloclist(0, [], 'f')
+ call assert_false(bufexists(qfbnum))
+
+ " When the location list is freed with the location list window open, the
+ " location list buffer should not be lost. It should be reused when the
+ " location list is again populated.
+ lexpr "F1:10:Line10"
+ lopen
+ let wid = win_getid()
+ let qfbnum = bufnr('')
+ wincmd p
+ call setloclist(0, [], 'f')
+ lexpr "F1:10:Line10"
+ lopen
+ call assert_equal(wid, win_getid())
+ call assert_equal(qfbnum, bufnr(''))
+ lclose
+
+ " When the window with the location list is closed, the buffer should be
+ " removed
new | only
- call assert_false(bufloaded(qfbnum))
+ call assert_false(bufexists(qfbnum))
endif
endfunc