From: glepnir Date: Sat, 18 Jul 2026 09:50:11 +0000 (+0000) Subject: patch 9.2.0790: 'completeslash' breaks :find completion with 'findfunc' X-Git-Tag: v9.2.0790^0 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=475690d794ef2bc3643f53835abcc792581b85da;p=thirdparty%2Fvim.git patch 9.2.0790: 'completeslash' breaks :find completion with 'findfunc' Problem: On MS-Windows with 'completeslash' set, an item completed by 'findfunc' cannot be opened with :find, E345 is given (Mao-Yining) Solution: Do not apply 'completeslash' to matches returned by 'findfunc', they are opaque strings that are passed back to the function unchanged (glepnir) fixes: #20770 closes: #20771 Signed-off-by: glepnir Signed-off-by: Christian Brabandt --- diff --git a/src/cmdexpand.c b/src/cmdexpand.c index bedcfdf368..9782993758 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -3346,7 +3346,9 @@ expand_files_and_dirs( if (free_pat) vim_free(pat); #ifdef BACKSLASH_IN_FILENAME - if (p_csl[0] != NUL && (options & WILD_IGNORE_COMPLETESLASH) == 0) + if (p_csl[0] != NUL + && (options & WILD_IGNORE_COMPLETESLASH) == 0 + && xp->xp_context != EXPAND_FINDFUNC) { int j; diff --git a/src/testdir/test_findfile.vim b/src/testdir/test_findfile.vim index a5f1f6fdd4..3de2463feb 100644 --- a/src/testdir/test_findfile.vim +++ b/src/testdir/test_findfile.vim @@ -898,4 +898,29 @@ func Test_path_env_variable_with_whitespaces() enew endfunc +func Test_findfunc_completeslash() + CheckMSWindows + + func FindBsl(pat, cmdarg) + return ['Xdir\foo.c']->matchfuzzy(a:pat) + endfunc + func FindFwd(pat, cmdarg) + return ['Xdir/foo.c']->matchfuzzy(a:pat) + endfunc + + set findfunc=FindBsl + set completeslash=slash + call feedkeys(":find Xdir\\\"\", 'tx') + call assert_equal('"find Xdir\foo.c', @:) + + set findfunc=FindFwd + set completeslash=backslash + call feedkeys(":find Xdir\\\"\", 'tx') + call assert_equal('"find Xdir/foo.c', @:) + + set completeslash& findfunc& + delfunc FindBsl + delfunc FindFwd +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 86904555a2..f9abe4fa15 100644 --- a/src/version.c +++ b/src/version.c @@ -759,6 +759,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 790, /**/ 789, /**/