]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0761: :cd completion fails on Windows with backslash in path v9.1.0761
authorChristian Brabandt <cb@256bit.org>
Sun, 6 Oct 2024 14:34:20 +0000 (16:34 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 6 Oct 2024 14:34:20 +0000 (16:34 +0200)
Problem:  :cd completion fails on Windows with backslash in path
Solution: switch no_bslash argument to FALSE in file_pat_to_reg_pat()

Note: only fixes the problem on Windows. For Unix, we still need to
escape backslashes since those are taken as regex atoms (and could be
invalid regex atoms).

fixes: #15643
closes: #15808

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/fileio.c
src/findfile.c
src/testdir/test_cmdline.vim
src/version.c

index 5fee4e0be970bcd14b94be425197f3071ff48768..41e5b5dbf7bea3560a689aea4bf2655ab4888a33 100644 (file)
@@ -5570,6 +5570,8 @@ match_file_list(char_u *list, char_u *sfname, char_u *ffname)
  * allow_dirs, otherwise FALSE is put there -- webb.
  * Handle backslashes before special characters, like "\*" and "\ ".
  *
+ * no_bslash only makes a difference, when BACKSLASH_IN_FILENAME is defined
+ *
  * Returns NULL when out of memory.
  */
     char_u *
index 4310a508c1c1898a29002ad2433f821df0dea240..b6ee0920fd278b1199b1c7fc74dec50b785326cf 100644 (file)
@@ -2362,7 +2362,7 @@ uniquefy_paths(
     file_pattern[0] = '*';
     file_pattern[1] = NUL;
     STRCAT(file_pattern, pattern);
-    pat = file_pat_to_reg_pat(file_pattern, NULL, NULL, TRUE);
+    pat = file_pat_to_reg_pat(file_pattern, NULL, NULL, FALSE);
     vim_free(file_pattern);
     if (pat == NULL)
        return;
index 4fec1c1c86d5307b9b0b7b5d1f386acccb95084a..2b392c553297ea4893fa72cd846dce3394aa2f78 100644 (file)
@@ -3920,4 +3920,15 @@ func Test_ex_command_completion()
   set cpo-=*
 endfunc
 
+func Test_cd_bslsh_completion_windows()
+  CheckMSWindows
+  let save_shellslash = &shellslash
+  set noshellslash
+  call system('mkdir XXXa\_b')
+  defer delete('XXXa', 'rf')
+  call feedkeys(":cd XXXa\\_b\<C-A>\<C-B>\"\<CR>", 'tx')
+  call assert_equal('"cd XXXa\_b\', @:)
+  let &shellslash = save_shellslash
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index eff0cf824db7f15d1609826988646fe3428f4d59..3b8e7fbe8251a80416fbfbee236234d2b7be5c3f 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    761,
 /**/
     760,
 /**/