1
0
forked from aniani/vim

patch 9.0.1688: cannot store custom data in quickfix list

Problem: cannot store custom data in quickfix list
Solution: add `user_data` field for the quickfix list

closes: #11818

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Tom Praschan <13141438+tom-anders@users.noreply.github.com>
This commit is contained in:
Tom Praschan
2023-08-11 23:26:12 +02:00
committed by Christian Brabandt
parent 7e0bae024d
commit ca6ac99077
4 changed files with 74 additions and 2 deletions

View File

@@ -1808,13 +1808,23 @@ func SetXlistTests(cchar, bnum)
call s:setup_commands(a:cchar)
call g:Xsetlist([{'bufnr': a:bnum, 'lnum': 1},
\ {'bufnr': a:bnum, 'lnum': 2, 'end_lnum': 3, 'col': 4, 'end_col': 5}])
\ {'bufnr': a:bnum, 'lnum': 2, 'end_lnum': 3, 'col': 4, 'end_col': 5, 'user_data': {'6': [7, 8]}}])
let l = g:Xgetlist()
call assert_equal(2, len(l))
call assert_equal(2, l[1].lnum)
call assert_equal(3, l[1].end_lnum)
call assert_equal(4, l[1].col)
call assert_equal(5, l[1].end_col)
call assert_equal({'6': [7, 8]}, l[1].user_data)
" Test that user_data is garbage collected
call g:Xsetlist([{'user_data': ['high', 5]},
\ {'user_data': {'this': [7, 'eight'], 'is': ['a', 'dictionary']}}])
call test_garbagecollect_now()
let l = g:Xgetlist()
call assert_equal(2, len(l))
call assert_equal(['high', 5], l[0].user_data)
call assert_equal({'this': [7, 'eight'], 'is': ['a', 'dictionary']}, l[1].user_data)
Xnext
call g:Xsetlist([{'bufnr': a:bnum, 'lnum': 3}], 'a')