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

2f6efaccfd

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2024-10-28 16:09:39 +08:00
parent 378d9135e7
commit 6b8c3d146e
6 changed files with 105 additions and 35 deletions

View File

@@ -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 (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);
}
if (options & WILD_ICASE) {
flags |= EW_ICASE;
}
// Expand wildcards, supporting %:h and the like.
int ret = expand_wildcards_eval(&pat, numMatches, matches, flags);
if (free_pat) {
xfree(pat);
}