From 30f606fc602f835fbed869140d3d658e24129c22 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 23 Dec 2022 13:56:32 +0800 Subject: fix(options): restore exists() behavior for options (#21510) Duplicating get_option_value() logic for an obscure future refactor isn't really worthwhile, and findoption() isn't used anywhere else outside the options code. --- src/nvim/eval/funcs.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/nvim/eval/funcs.c') diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 8bdb91ebf1..eb34869fac 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -1721,14 +1721,9 @@ static void f_exists(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) xfree(exp); } } else if (*p == '&' || *p == '+') { // Option. - bool working = (*p == '+'); // whether option needs to be working - int opt_flags; - - if (find_option_end(&p, &opt_flags) != NULL) { - int opt_idx = findoption(p); - n = (opt_idx >= 0 && (!working || get_varp_scope(get_option(opt_idx), opt_flags) != NULL)); - } else { - n = false; + n = (get_option_tv(&p, NULL, true) == OK); + if (*skipwhite(p) != NUL) { + n = false; // Trailing garbage. } } else if (*p == '*') { // Internal or user defined function. n = function_exists(p + 1, false); -- cgit