commit 07f59467da5a80c7ce46fdc9efcc0e2c18633df1
parent ba8b5649867aa0d349de789828940a48bb42888c
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri, 17 Mar 2023 20:09:56 +0800
refactor(completion): don't add and remove '^' for Lua (#22702)
Diffstat:
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
@@ -1206,7 +1206,6 @@ char *addstar(char *fname, size_t len, int context)
// For help tags the translation is done in find_help_tags().
// For a tag pattern starting with "/" no translation is needed.
if (context == EXPAND_HELP
- || context == EXPAND_CHECKHEALTH
|| context == EXPAND_COLORS
|| context == EXPAND_COMPILER
|| context == EXPAND_OWNSYNTAX
@@ -1214,7 +1213,9 @@ char *addstar(char *fname, size_t len, int context)
|| context == EXPAND_PACKADD
|| context == EXPAND_RUNTIME
|| ((context == EXPAND_TAGS_LISTFILES || context == EXPAND_TAGS)
- && fname[0] == '/')) {
+ && fname[0] == '/')
+ || context == EXPAND_CHECKHEALTH
+ || context == EXPAND_LUA) {
retval = xstrnsave(fname, len);
} else {
new_len = len + 2; // +2 for '^' at start, NUL at end
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
@@ -1857,12 +1857,6 @@ int nlua_expand_pat(expand_T *xp, char *pat, int *num_results, char ***results)
lua_getfield(lstate, -1, "_expand_pat");
luaL_checktype(lstate, -1, LUA_TFUNCTION);
- // ex expansion prepends a ^, but don't worry, it is not a regex
- if (pat[0] != '^') {
- return FAIL;
- }
- pat++;
-
// [ vim, vim._expand_pat, buf ]
lua_pushlstring(lstate, (const char *)pat, strlen(pat));