mirror of
https://github.com/vim/vim.git
synced 2025-10-04 05:25:06 -04:00
patch 8.2.3900: it is not easy to use a script-local function for an option
Problem: It is not easy to use a script-local function for an option. Solution: recognize s: and <SID> at the start of the expression. (Yegappan Lakshmanan, closes #9401)
This commit is contained in:
committed by
Bram Moolenaar
parent
ec86520f94
commit
8bb65f230d
@@ -681,8 +681,19 @@ func Test_diffexpr()
|
||||
set diffexpr=NewDiffFunc()
|
||||
call assert_fails('windo diffthis', ['E117:', 'E97:'])
|
||||
diffoff!
|
||||
|
||||
" Using a script-local function
|
||||
func s:NewDiffExpr()
|
||||
endfunc
|
||||
set diffexpr=s:NewDiffExpr()
|
||||
call assert_equal(expand('<SID>') .. 'NewDiffExpr()', &diffexpr)
|
||||
set diffexpr=<SID>NewDiffExpr()
|
||||
call assert_equal(expand('<SID>') .. 'NewDiffExpr()', &diffexpr)
|
||||
|
||||
%bwipe!
|
||||
set diffexpr& diffopt&
|
||||
delfunc DiffExpr
|
||||
delfunc s:NewDiffExpr
|
||||
endfunc
|
||||
|
||||
func Test_diffpatch()
|
||||
@@ -1216,10 +1227,19 @@ func Test_patchexpr()
|
||||
call assert_equal(2, winnr('$'))
|
||||
call assert_true(&diff)
|
||||
|
||||
" Using a script-local function
|
||||
func s:NewPatchExpr()
|
||||
endfunc
|
||||
set patchexpr=s:NewPatchExpr()
|
||||
call assert_equal(expand('<SID>') .. 'NewPatchExpr()', &patchexpr)
|
||||
set patchexpr=<SID>NewPatchExpr()
|
||||
call assert_equal(expand('<SID>') .. 'NewPatchExpr()', &patchexpr)
|
||||
|
||||
call delete('Xinput')
|
||||
call delete('Xdiff')
|
||||
set patchexpr&
|
||||
delfunc TPatch
|
||||
delfunc s:NewPatchExpr
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
|
Reference in New Issue
Block a user