1
0
forked from aniani/vim

patch 9.0.0285: it is not easy to change the command line from a plugin

Problem:    It is not easy to change the command line from a plugin.
Solution:   Add setcmdline(). (Shougo Matsushita, closes #10869)
This commit is contained in:
Shougo Matsushita
2022-08-27 12:22:25 +01:00
committed by Bram Moolenaar
parent 5ff595d9db
commit 07ea5f1509
8 changed files with 134 additions and 11 deletions

View File

@@ -3657,6 +3657,12 @@ def Test_setcharsearch()
assert_equal(d, getcharsearch())
enddef
def Test_setcmdline()
v9.CheckDefAndScriptSuccess(['setcmdline("ls", 2)'])
v9.CheckDefAndScriptFailure(['setcmdline(123)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E928: String required'])
v9.CheckDefAndScriptFailure(['setcmdline("ls", "x")'], ['E1013: Argument 2: type mismatch, expected number but got string', 'E1030: Using a String as a Number'])
enddef
def Test_setcmdpos()
v9.CheckDefAndScriptFailure(['setcmdpos("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1'])
enddef