Mercurial > vim
diff src/testdir/test_quickfix.vim @ 26618:b531c26f728b v8.2.3838
patch 8.2.3838: cannot use script-local function for setting *func options
Commit: https://github.com/vim/vim/commit/db1a410b610b2c1941311acc57dcc4afec20720e
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Fri Dec 17 16:21:20 2021 +0000
patch 8.2.3838: cannot use script-local function for setting *func options
Problem: Cannot use script-local function for setting *func options.
Solution: Use the script context. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/9362)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 17 Dec 2021 17:30:04 +0100 |
parents | c675779d5f2b |
children | 4c16acb2525f |
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -5387,6 +5387,23 @@ func Test_qftextfunc_callback() END call CheckLegacyAndVim9Success(lines) + " Test for using a script-local function name + func s:TqfFunc2(info) + let g:TqfFunc2Args = [a:info.start_idx, a:info.end_idx] + return '' + endfunc + let g:TqfFunc2Args = [] + set quickfixtextfunc=s:TqfFunc2 + cexpr "F10:10:10:L10" + cclose + call assert_equal([1, 1], g:TqfFunc2Args) + + let &quickfixtextfunc = 's:TqfFunc2' + cexpr "F11:11:11:L11" + cclose + call assert_equal([1, 1], g:TqfFunc2Args) + delfunc s:TqfFunc2 + " set 'quickfixtextfunc' to a partial with dict. This used to cause a crash. func SetQftfFunc() let params = {'qftf': function('g:DictQftfFunc')}