Mercurial > vim
changeset 34567:7de5ae6a0518 v9.1.0182
patch 9.1.0182: Can define function with invalid name inside 'formatexpr'
Commit: https://github.com/vim/vim/commit/6a04bf5ee523b2d6d01d7290e356a30de219f465
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat Mar 16 09:39:06 2024 +0100
patch 9.1.0182: Can define function with invalid name inside 'formatexpr'
Problem: Can define function with invalid name inside 'formatexpr'.
Solution: Use goto instead of checking for did_emsg later.
(zeertzjq)
closes: #14209
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Mar 2024 09:45:04 +0100 |
parents | 7a3de23515d6 |
children | 004ccc9cb0f8 |
files | src/testdir/test_user_func.vim src/userfunc.c src/version.c |
diffstat | 3 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_user_func.vim +++ b/src/testdir/test_user_func.vim @@ -968,4 +968,23 @@ func Test_multidefer_with_exception() delfunc Foo endfunc +func Test_func_curly_brace_invalid_name() + func Fail() + func Foo{'()'}bar() + endfunc + endfunc + + call assert_fails('call Fail()', 'E475: Invalid argument: Foo()bar') + + silent! call Fail() + call assert_equal([], getcompletion('Foo', 'function')) + + set formatexpr=Fail() + normal! gqq + call assert_equal([], getcompletion('Foo', 'function')) + + set formatexpr& + delfunc Fail +endfunc + " vim: shiftwidth=2 sts=2 expandtab