mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.2274 (#5439)
Problem: Command line completion on "find **/filename" drops sub-directory.
Solution: Handle this case separately. (Harm te Hennepe, closes vim/vim#932, closes
vim/vim#939)
73d4e4c892
This commit is contained in:
parent
68f7464eed
commit
3a54ce5a73
@ -903,17 +903,30 @@ static void 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
|
||||||
pathsep_p = path + len - 1;
|
// pattern starts with **/, so only remove path_cutoff
|
||||||
|
// when possible.
|
||||||
while (find_previous_pathsep(path, &pathsep_p))
|
if (pattern[0] == '*' && pattern[1] == '*'
|
||||||
if (vim_regexec(®match, pathsep_p + 1, (colnr_T)0)
|
&& vim_ispathsep_nocolon(pattern[2])
|
||||||
&& is_unique(pathsep_p + 1, gap, i)
|
&& path_cutoff != NULL
|
||||||
&& path_cutoff != NULL && pathsep_p + 1 >= path_cutoff) {
|
&& vim_regexec(®match, path_cutoff, (colnr_T)0)
|
||||||
sort_again = true;
|
&& is_unique(path_cutoff, gap, i)) {
|
||||||
memmove(path, pathsep_p + 1, STRLEN(pathsep_p));
|
sort_again = true;
|
||||||
break;
|
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;
|
||||||
|
while (find_previous_pathsep(path, &pathsep_p)) {
|
||||||
|
if (vim_regexec(®match, pathsep_p + 1, (colnr_T)0)
|
||||||
|
&& is_unique(pathsep_p + 1, gap, i)
|
||||||
|
&& path_cutoff != NULL && pathsep_p + 1 >= path_cutoff) {
|
||||||
|
sort_again = true;
|
||||||
|
memmove(path, pathsep_p + 1, STRLEN(pathsep_p));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (path_is_absolute_path(path)) {
|
if (path_is_absolute_path(path)) {
|
||||||
/*
|
/*
|
||||||
|
@ -152,3 +152,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
|
||||||
|
@ -167,7 +167,7 @@ static int included_patches[] = {
|
|||||||
// 2277,
|
// 2277,
|
||||||
// 2276,
|
// 2276,
|
||||||
// 2275,
|
// 2275,
|
||||||
// 2274,
|
2274,
|
||||||
// 2273,
|
// 2273,
|
||||||
// 2272,
|
// 2272,
|
||||||
// 2271 NA
|
// 2271 NA
|
||||||
|
Loading…
Reference in New Issue
Block a user