Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
26617:86ca0d6a6a34 | 26618:b531c26f728b |
---|---|
5385 call assert_equal('F9-L9C9-L9', getline(1)) | 5385 call assert_equal('F9-L9C9-L9', getline(1)) |
5386 cclose | 5386 cclose |
5387 END | 5387 END |
5388 call CheckLegacyAndVim9Success(lines) | 5388 call CheckLegacyAndVim9Success(lines) |
5389 | 5389 |
5390 " Test for using a script-local function name | |
5391 func s:TqfFunc2(info) | |
5392 let g:TqfFunc2Args = [a:info.start_idx, a:info.end_idx] | |
5393 return '' | |
5394 endfunc | |
5395 let g:TqfFunc2Args = [] | |
5396 set quickfixtextfunc=s:TqfFunc2 | |
5397 cexpr "F10:10:10:L10" | |
5398 cclose | |
5399 call assert_equal([1, 1], g:TqfFunc2Args) | |
5400 | |
5401 let &quickfixtextfunc = 's:TqfFunc2' | |
5402 cexpr "F11:11:11:L11" | |
5403 cclose | |
5404 call assert_equal([1, 1], g:TqfFunc2Args) | |
5405 delfunc s:TqfFunc2 | |
5406 | |
5390 " set 'quickfixtextfunc' to a partial with dict. This used to cause a crash. | 5407 " set 'quickfixtextfunc' to a partial with dict. This used to cause a crash. |
5391 func SetQftfFunc() | 5408 func SetQftfFunc() |
5392 let params = {'qftf': function('g:DictQftfFunc')} | 5409 let params = {'qftf': function('g:DictQftfFunc')} |
5393 let &quickfixtextfunc = params.qftf | 5410 let &quickfixtextfunc = params.qftf |
5394 endfunc | 5411 endfunc |