mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.1.0345: cannot get the window id associated with the location list
Problem: Cannot get the window id associated with the location list. Solution: Add the "filewinid" argument to getloclist(). (Yegappan Lakshmanan, closes #3202)
This commit is contained in:
@@ -1973,6 +1973,18 @@ func Xproperty_tests(cchar)
|
||||
call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F1', 'lnum' : 10, 'text' : 'L10'}]})
|
||||
call assert_equal('TestTitle', g:Xgetlist({'title' : 1}).title)
|
||||
|
||||
" Test for getting id of window associated with a location list window
|
||||
if a:cchar == 'l'
|
||||
only
|
||||
call assert_equal(0, g:Xgetlist({'all' : 1}).filewinid)
|
||||
let wid = win_getid()
|
||||
Xopen
|
||||
call assert_equal(wid, g:Xgetlist({'filewinid' : 1}).filewinid)
|
||||
wincmd w
|
||||
call assert_equal(0, g:Xgetlist({'filewinid' : 1}).filewinid)
|
||||
only
|
||||
endif
|
||||
|
||||
" The following used to crash Vim with address sanitizer
|
||||
call g:Xsetlist([], 'f')
|
||||
call g:Xsetlist([], 'a', {'items' : [{'filename':'F1', 'lnum':10}]})
|
||||
@@ -3000,7 +3012,17 @@ func Xgetlist_empty_tests(cchar)
|
||||
call assert_equal('', g:Xgetlist({'title' : 0}).title)
|
||||
call assert_equal(0, g:Xgetlist({'winid' : 0}).winid)
|
||||
call assert_equal(0, g:Xgetlist({'changedtick' : 0}).changedtick)
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0, 'changedtick': 0}, g:Xgetlist({'all' : 0}))
|
||||
if a:cchar == 'c'
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0,
|
||||
\ 'items' : [], 'nr' : 0, 'size' : 0,
|
||||
\ 'title' : '', 'winid' : 0, 'changedtick': 0},
|
||||
\ g:Xgetlist({'all' : 0}))
|
||||
else
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0,
|
||||
\ 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '',
|
||||
\ 'winid' : 0, 'changedtick': 0, 'filewinid' : 0},
|
||||
\ g:Xgetlist({'all' : 0}))
|
||||
endif
|
||||
|
||||
" Quickfix window with empty stack
|
||||
silent! Xopen
|
||||
@@ -3033,7 +3055,16 @@ func Xgetlist_empty_tests(cchar)
|
||||
call assert_equal('', g:Xgetlist({'id' : qfid, 'title' : 0}).title)
|
||||
call assert_equal(0, g:Xgetlist({'id' : qfid, 'winid' : 0}).winid)
|
||||
call assert_equal(0, g:Xgetlist({'id' : qfid, 'changedtick' : 0}).changedtick)
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0, 'changedtick' : 0}, g:Xgetlist({'id' : qfid, 'all' : 0}))
|
||||
if a:cchar == 'c'
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [],
|
||||
\ 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0,
|
||||
\ 'changedtick' : 0}, g:Xgetlist({'id' : qfid, 'all' : 0}))
|
||||
else
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [],
|
||||
\ 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0,
|
||||
\ 'changedtick' : 0, 'filewinid' : 0},
|
||||
\ g:Xgetlist({'id' : qfid, 'all' : 0}))
|
||||
endif
|
||||
|
||||
" Non-existing quickfix list number
|
||||
call assert_equal('', g:Xgetlist({'nr' : 5, 'context' : 0}).context)
|
||||
@@ -3045,7 +3076,16 @@ func Xgetlist_empty_tests(cchar)
|
||||
call assert_equal('', g:Xgetlist({'nr' : 5, 'title' : 0}).title)
|
||||
call assert_equal(0, g:Xgetlist({'nr' : 5, 'winid' : 0}).winid)
|
||||
call assert_equal(0, g:Xgetlist({'nr' : 5, 'changedtick' : 0}).changedtick)
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [], 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0, 'changedtick' : 0}, g:Xgetlist({'nr' : 5, 'all' : 0}))
|
||||
if a:cchar == 'c'
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [],
|
||||
\ 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0,
|
||||
\ 'changedtick' : 0}, g:Xgetlist({'nr' : 5, 'all' : 0}))
|
||||
else
|
||||
call assert_equal({'context' : '', 'id' : 0, 'idx' : 0, 'items' : [],
|
||||
\ 'nr' : 0, 'size' : 0, 'title' : '', 'winid' : 0,
|
||||
\ 'changedtick' : 0, 'filewinid' : 0},
|
||||
\ g:Xgetlist({'nr' : 5, 'all' : 0}))
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_getqflist()
|
||||
|
Reference in New Issue
Block a user