]> granicus.if.org Git - vim/commitdiff
patch 8.2.3393: escaping for fish shell is skipping some characters v8.2.3393
authorBram Moolenaar <Bram@vim.org>
Wed, 1 Sep 2021 12:31:51 +0000 (14:31 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 1 Sep 2021 12:31:51 +0000 (14:31 +0200)
Problem:    Escaping for fish shell is skipping some characters.
Solution:   Escape character after backslash if needed. (Jason Cox,
            closes #8827)

src/strings.c
src/testdir/test_shell.vim
src/version.c

index 0c9e20d176a28673ca6c8ac885b0d01648cd8cd3..d2d37d80f6f3eb0f4c91c7cdd707ae2650c041ca 100644 (file)
@@ -281,6 +281,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline)
            {
                *d++ = '\\';
                *d++ = *p++;
+               continue;
            }
 
            MB_COPY_CHAR(p, d);
index fa11f08d726883e41aa390a2b7ed912f1415dc5b..a6aa10ea2547603077f8923b6d38dc7dccbc169e 100644 (file)
@@ -61,21 +61,21 @@ func Test_shell_options()
   for e in shells
     exe 'set shell=' .. e[0]
     if e[0] =~# '.*csh$' || e[0] =~# '.*csh.exe$'
-      let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%# \\'"
-      let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\# \\'"
+      let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%# \\'\\'' \\\\! \\% \\#'"
+      let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\# \\'\\'' \\\\\\! \\\\% \\\\#'"
     elseif e[0] =~# '.*powershell$' || e[0] =~# '.*powershell.exe$'
           \ || e[0] =~# '.*pwsh$' || e[0] =~# '.*pwsh.exe$'
-      let str1 = "'cmd \"arg1\" ''arg2'' !%# \\'"
-      let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\# \\'"
+      let str1 = "'cmd \"arg1\" ''arg2'' !%# \\'' \\! \\% \\#'"
+      let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\# \\'' \\\\! \\\\% \\\\#'"
     elseif e[0] =~# '.*fish$' || e[0] =~# '.*fish.exe$'
-      let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\\\'"
-      let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\\\'"
+      let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\\\'\\'' \\\\! \\\\% \\\\#'"
+      let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\\\'\\'' \\\\\\! \\\\\\% \\\\\\#'"
     else
-      let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\'"
-      let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\'"
+      let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\'\\'' \\! \\% \\#'"
+      let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\'\\'' \\\\! \\\\% \\\\#'"
     endif
-    call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%# \\"), e[0])
-    call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%# \\", 1), e[0])
+    call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%# \\' \\! \\% \\#"), e[0])
+    call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%# \\' \\! \\% \\#", 1), e[0])
 
     " Try running an external command with the shell.
     if executable(e[0])
index 9f67d7964dfd11ccbb149370f156cb85f3a83c82..3a16ddad8171320bd7ee698edf53f5f8d8c05f23 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3393,
 /**/
     3392,
 /**/