comparison src/testdir/test_edit.vim @ 26743:c2c40cefc17b v8.2.3900

patch 8.2.3900: it is not easy to use a script-local function for an option Commit: https://github.com/vim/vim/commit/8bb65f230d3025037f34021a72616038da0601ee Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Dec 26 10:51:39 2021 +0000 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)
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Dec 2021 12:00:04 +0100
parents 9f445e07f766
children b975b7c16ba1
comparison
equal deleted inserted replaced
26742:00732e690ee8 26743:c2c40cefc17b
322 call feedkeys("othen\<cr>that\<cr>fi", 'tnix') 322 call feedkeys("othen\<cr>that\<cr>fi", 'tnix')
323 call assert_equal(['if [ $this ]', "then", "\<tab>that", "fi"], getline(1, '$')) 323 call assert_equal(['if [ $this ]', "then", "\<tab>that", "fi"], getline(1, '$'))
324 set cinkeys&vim indentkeys&vim 324 set cinkeys&vim indentkeys&vim
325 set nocindent indentexpr= 325 set nocindent indentexpr=
326 delfu Do_Indent 326 delfu Do_Indent
327
328 " Using a script-local function
329 func s:NewIndentExpr()
330 endfunc
331 set indentexpr=s:NewIndentExpr()
332 call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &indentexpr)
333 set indentexpr=<SID>NewIndentExpr()
334 call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &indentexpr)
335 set indentexpr&
336
327 bw! 337 bw!
328 endfunc 338 endfunc
329 339
330 " Test changing indent in replace mode 340 " Test changing indent in replace mode
331 func Test_edit_12() 341 func Test_edit_12()