To: vim_dev@googlegroups.com Subject: Patch 7.4.2274 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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) Files: src/misc1.c, src/testdir/test_cmdline.vim *** ../vim-7.4.2273/src/misc1.c 2016-08-16 22:50:50.758254682 +0200 --- src/misc1.c 2016-08-27 21:54:43.767301285 +0200 *************** *** 10514,10531 **** /* Shorten the filename while maintaining its uniqueness */ path_cutoff = get_path_cutoff(path, &path_ga); ! /* 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; ! mch_memmove(path, pathsep_p + 1, STRLEN(pathsep_p)); ! break; ! } if (mch_isFullName(path)) { --- 10514,10547 ---- /* Shorten the filename while maintaining its uniqueness */ path_cutoff = get_path_cutoff(path, &path_ga); ! /* 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; ! 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; ! mch_memmove(path, pathsep_p + 1, STRLEN(pathsep_p)); ! break; ! } ! } if (mch_isFullName(path)) { *** ../vim-7.4.2273/src/testdir/test_cmdline.vim 2016-08-13 15:07:38.347640696 +0200 --- src/testdir/test_cmdline.vim 2016-08-27 21:45:11.288072724 +0200 *************** *** 180,182 **** --- 180,190 ---- call assert_fails('call getcompletion("", "burp")', 'E475:') endfunc + + func Test_expand_star_star() + call mkdir('a/b', 'p') + call writefile(['asdfasdf'], 'a/b/fileXname') + call feedkeys(":find **/fileXname\\", 'xt') + call assert_equal('find a/b/fileXname', getreg(':')) + call delete('a', 'rf') + endfunc *** ../vim-7.4.2273/src/version.c 2016-08-27 21:25:22.702047671 +0200 --- src/version.c 2016-08-27 21:53:12.788059747 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2274, /**/ -- From "know your smileys": <>:-) Bishop /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///