Mercurial > vim
comparison src/evalfunc.c @ 9672:6255ff1ea003 v7.4.2112
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 28 22:53:37 2016 +0200
patch 7.4.2112
Problem: getcompletion(.., 'dir') returns a match with trailing "*" when
there are no matches. (Chdiza)
Solution: Return an empty list when there are no matches. Add a trailing
slash to directories. (Yegappan Lakshmanan) Add tests for no
matches. (closes #947)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 28 Jul 2016 23:00:06 +0200 |
parents | fd9727ae3c49 |
children | 4a7a88404076 |
comparison
equal
deleted
inserted
replaced
9671:5d7216118c8a | 9672:6255ff1ea003 |
---|---|
4162 static void | 4162 static void |
4163 f_getcompletion(typval_T *argvars, typval_T *rettv) | 4163 f_getcompletion(typval_T *argvars, typval_T *rettv) |
4164 { | 4164 { |
4165 char_u *pat; | 4165 char_u *pat; |
4166 expand_T xpc; | 4166 expand_T xpc; |
4167 int options = WILD_KEEP_ALL | WILD_SILENT | WILD_USE_NL | 4167 int options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH |
4168 | WILD_LIST_NOTFOUND | WILD_NO_BEEP; | 4168 | WILD_NO_BEEP; |
4169 | 4169 |
4170 if (p_wic) | 4170 if (p_wic) |
4171 options |= WILD_ICASE; | 4171 options |= WILD_ICASE; |
4172 | 4172 |
4173 ExpandInit(&xpc); | 4173 ExpandInit(&xpc); |
4192 # endif | 4192 # endif |
4193 | 4193 |
4194 pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context); | 4194 pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context); |
4195 if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL)) | 4195 if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL)) |
4196 { | 4196 { |
4197 int i; | 4197 int i; |
4198 | 4198 |
4199 ExpandOne(&xpc, pat, NULL, options, WILD_ALL_KEEP); | 4199 ExpandOne(&xpc, pat, NULL, options, WILD_ALL_KEEP); |
4200 | 4200 |
4201 for (i = 0; i < xpc.xp_numfiles; i++) | 4201 for (i = 0; i < xpc.xp_numfiles; i++) |
4202 list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1); | 4202 list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1); |