From 6b8c3d146ec0308fd19a9142b23b5e342e2cdcf8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 28 Oct 2024 16:09:39 +0800 Subject: vim-patch:9.1.0811: :find expansion does not consider 'findexpr' Problem: :find expansion does not consider 'findexpr' Solution: Support expanding :find command argument using 'findexpr' (Yegappan Lakshmanan) closes: vim/vim#15929 https://github.com/vim/vim/commit/2f6efaccfd5c4e7df1f54ed0f41f329abbe05f60 Co-authored-by: Yegappan Lakshmanan --- src/nvim/cmdexpand.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src/nvim/cmdexpand.c') diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index 549ed826bc..5b7017481e 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -2497,21 +2497,25 @@ static int expand_files_and_dirs(expand_T *xp, char *pat, char ***matches, int * } } - if (xp->xp_context == EXPAND_FILES) { - flags |= EW_FILE; - } else if (xp->xp_context == EXPAND_FILES_IN_PATH) { - flags |= (EW_FILE | EW_PATH); - } else if (xp->xp_context == EXPAND_DIRS_IN_CDPATH) { - flags = (flags | EW_DIR | EW_CDPATH) & ~EW_FILE; + int ret = FAIL; + if (xp->xp_context == EXPAND_FILES_IN_PATH && *get_findexpr() != NUL) { + ret = expand_findexpr(pat, matches, numMatches); } else { - flags = (flags | EW_DIR) & ~EW_FILE; - } - if (options & WILD_ICASE) { - flags |= EW_ICASE; + if (xp->xp_context == EXPAND_FILES) { + flags |= EW_FILE; + } else if (xp->xp_context == EXPAND_FILES_IN_PATH) { + flags |= (EW_FILE | EW_PATH); + } else if (xp->xp_context == EXPAND_DIRS_IN_CDPATH) { + flags = (flags | EW_DIR | EW_CDPATH) & ~EW_FILE; + } else { + flags = (flags | EW_DIR) & ~EW_FILE; + } + if (options & WILD_ICASE) { + flags |= EW_ICASE; + } + // Expand wildcards, supporting %:h and the like. + ret = expand_wildcards_eval(&pat, numMatches, matches, flags); } - - // Expand wildcards, supporting %:h and the like. - int ret = expand_wildcards_eval(&pat, numMatches, matches, flags); if (free_pat) { xfree(pat); } -- cgit