aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-11-28 09:02:10 +0800
committerGitHub <noreply@github.com>2024-11-28 09:02:10 +0800
commit5897994cb75b5b64a34017873119c87a75c42375 (patch)
tree7f579a1eebcd3e3487ebe5e58f33a94dc803b80d /test
parent76dcc7029b200e1d85024d7ba4a34c602e730dbe (diff)
downloadrneovim-5897994cb75b5b64a34017873119c87a75c42375.tar.gz
rneovim-5897994cb75b5b64a34017873119c87a75c42375.tar.bz2
rneovim-5897994cb75b5b64a34017873119c87a75c42375.zip
vim-patch:9.1.0890: %! item not allowed for 'rulerformat' (#31369)
Problem: %! item not allowed for 'rulerformat' (yatinlala) Solution: also allow to use %! for rulerformat option (Yegappan Lakshmanan) fixes: vim/vim#16091 closes: vim/vim#16118 https://github.com/vim/vim/commit/ac023e8baae65584537aa3c11494dad6f71770af Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/cmdline_spec.lua16
-rw-r--r--test/old/testdir/test_cmdline.vim21
2 files changed, 37 insertions, 0 deletions
diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua
index bf146e1322..3addcb957c 100644
--- a/test/functional/legacy/cmdline_spec.lua
+++ b/test/functional/legacy/cmdline_spec.lua
@@ -216,6 +216,22 @@ describe('cmdline', function()
longish |
]]
end)
+
+ -- oldtest: Test_rulerformat_function()
+ it("'rulerformat' can use %!", function()
+ local screen = Screen.new(40, 2)
+ exec([[
+ func TestRulerFn()
+ return '10,20%=30%%'
+ endfunc
+ ]])
+ api.nvim_set_option_value('ruler', true, {})
+ api.nvim_set_option_value('rulerformat', '%!TestRulerFn()', {})
+ screen:expect([[
+ ^ |
+ 10,20 30% |
+ ]])
+ end)
end)
describe('cmdwin', function()
diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim
index 6fa3ee5250..2f34ecb414 100644
--- a/test/old/testdir/test_cmdline.vim
+++ b/test/old/testdir/test_cmdline.vim
@@ -4036,6 +4036,27 @@ func Test_rulerformat_position()
call StopVimInTerminal(buf)
endfunc
+" Test for using "%!" in 'rulerformat' to use a function
+func Test_rulerformat_function()
+ CheckScreendump
+
+ let lines =<< trim END
+ func TestRulerFn()
+ return '10,20%=30%%'
+ endfunc
+ END
+ call writefile(lines, 'Xrulerformat_function', 'D')
+
+ let buf = RunVimInTerminal('-S Xrulerformat_function', #{rows: 2, cols: 40})
+ call term_sendkeys(buf, ":set ruler rulerformat=%!TestRulerFn()\<CR>")
+ call term_sendkeys(buf, ":redraw!\<CR>")
+ call term_wait(buf)
+ call VerifyScreenDump(buf, 'Test_rulerformat_function', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_getcompletion_usercmd()
command! -nargs=* -complete=command TestCompletion echo <q-args>