mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 7.4.2274
Problem: Command line completion on "find **/filename" drops sub-directory. Solution: Handle this case separately. (Harm te Hennepe, closes #932, closes #939)
This commit is contained in:
18
src/misc1.c
18
src/misc1.c
@@ -10514,7 +10514,22 @@ uniquefy_paths(garray_T *gap, char_u *pattern)
|
|||||||
/* Shorten the filename while maintaining its uniqueness */
|
/* Shorten the filename while maintaining its uniqueness */
|
||||||
path_cutoff = get_path_cutoff(path, &path_ga);
|
path_cutoff = get_path_cutoff(path, &path_ga);
|
||||||
|
|
||||||
/* we start at the end of the path */
|
/* Don't assume all files can be reached without path when search
|
||||||
|
* pattern starts with star star slash, so only remove path_cutoff
|
||||||
|
* when possible. */
|
||||||
|
if (pattern[0] == '*' && pattern[1] == '*'
|
||||||
|
&& vim_ispathsep_nocolon(pattern[2])
|
||||||
|
&& path_cutoff != NULL
|
||||||
|
&& vim_regexec(®match, path_cutoff, (colnr_T)0)
|
||||||
|
&& is_unique(path_cutoff, gap, i))
|
||||||
|
{
|
||||||
|
sort_again = TRUE;
|
||||||
|
mch_memmove(path, path_cutoff, STRLEN(path_cutoff) + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Here all files can be reached without path, so get shortest
|
||||||
|
* unique path. We start at the end of the path. */
|
||||||
pathsep_p = path + len - 1;
|
pathsep_p = path + len - 1;
|
||||||
|
|
||||||
while (find_previous_pathsep(path, &pathsep_p))
|
while (find_previous_pathsep(path, &pathsep_p))
|
||||||
@@ -10526,6 +10541,7 @@ uniquefy_paths(garray_T *gap, char_u *pattern)
|
|||||||
mch_memmove(path, pathsep_p + 1, STRLEN(pathsep_p));
|
mch_memmove(path, pathsep_p + 1, STRLEN(pathsep_p));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mch_isFullName(path))
|
if (mch_isFullName(path))
|
||||||
{
|
{
|
||||||
|
@@ -180,3 +180,11 @@ func Test_getcompletion()
|
|||||||
|
|
||||||
call assert_fails('call getcompletion("", "burp")', 'E475:')
|
call assert_fails('call getcompletion("", "burp")', 'E475:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_expand_star_star()
|
||||||
|
call mkdir('a/b', 'p')
|
||||||
|
call writefile(['asdfasdf'], 'a/b/fileXname')
|
||||||
|
call feedkeys(":find **/fileXname\<Tab>\<CR>", 'xt')
|
||||||
|
call assert_equal('find a/b/fileXname', getreg(':'))
|
||||||
|
call delete('a', 'rf')
|
||||||
|
endfunc
|
||||||
|
@@ -763,6 +763,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2274,
|
||||||
/**/
|
/**/
|
||||||
2273,
|
2273,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user