1
0
forked from aniani/vim

patch 9.0.1243: :setglobal cannot use script-local function for "expr" option

Problem:    :setglobal cannot use script-local function for "expr" option.
Solution:   Use the pointer to the option value properly. (closes #11883)
This commit is contained in:
zeertzjq
2023-01-25 15:31:28 +00:00
committed by Bram Moolenaar
parent b0d45ec67f
commit 01d4efe2e8
6 changed files with 149 additions and 48 deletions

View File

@@ -330,8 +330,23 @@ func Test_edit_11_indentexpr()
endfunc
set indentexpr=s:NewIndentExpr()
call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &indentexpr)
call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &g:indentexpr)
set indentexpr=<SID>NewIndentExpr()
call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &indentexpr)
call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &g:indentexpr)
setlocal indentexpr=
setglobal indentexpr=s:NewIndentExpr()
call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &g:indentexpr)
call assert_equal('', &indentexpr)
new
call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &indentexpr)
bw!
setglobal indentexpr=<SID>NewIndentExpr()
call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &g:indentexpr)
call assert_equal('', &indentexpr)
new
call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &indentexpr)
bw!
set indentexpr&
bw!