From 0d3ee26860923e4be9f0a969b472a6ffaef4c83a Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 29 Nov 2025 09:04:05 -0500 Subject: [PATCH] vim-patch:9.0.0057: has('patch-xxx') returns true Problem: has('patch-xxx') returns true. Solution: Check for digit. (closes vim/vim#10751) https://github.com/vim/vim/commit/5154a8880034b7bb94186d37bcecc6ee1a96f732 Co-authored-by: Bram Moolenaar --- src/nvim/eval/funcs.c | 2 +- test/old/testdir/test_expr.vim | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index d2114ed3c4..e7b0e2bd7b 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -2813,7 +2813,7 @@ static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) && (minor < VIM_VERSION_MINOR || (minor == VIM_VERSION_MINOR && has_vim_patch(atoi(name + 10)))))); - } else { + } else if (ascii_isdigit(name[5])) { n = has_vim_patch(atoi(name + 5)); } } else if (STRNICMP(name, "nvim-", 5) == 0) { diff --git a/test/old/testdir/test_expr.vim b/test/old/testdir/test_expr.vim index 81023ef92f..c62dc9845d 100644 --- a/test/old/testdir/test_expr.vim +++ b/test/old/testdir/test_expr.vim @@ -43,6 +43,7 @@ func Test_version() call assert_false(has('patch-7.4.')) call assert_false(has('patch-9.1.0')) call assert_false(has('patch-9.9.1')) + call assert_false(has('patch-abc')) endfunc func Test_op_ternary()