Skip to content

Commit 6631597

Browse files
committed
patch 8.2.3393: escaping for fish shell is skipping some characters
Problem: Escaping for fish shell is skipping some characters. Solution: Escape character after backslash if needed. (Jason Cox, closes #8827)
1 parent b4d82e2 commit 6631597

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

src/strings.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline)
281281
{
282282
*d++ = '\\';
283283
*d++ = *p++;
284+
continue;
284285
}
285286

286287
MB_COPY_CHAR(p, d);

src/testdir/test_shell.vim

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,21 @@ func Test_shell_options()
6161
for e in shells
6262
exe 'set shell=' .. e[0]
6363
if e[0] =~# '.*csh$' || e[0] =~# '.*csh.exe$'
64-
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%# \\'"
65-
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\# \\'"
64+
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%# \\'\\'' \\\\! \\% \\#'"
65+
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\# \\'\\'' \\\\\\! \\\\% \\\\#'"
6666
elseif e[0] =~# '.*powershell$' || e[0] =~# '.*powershell.exe$'
6767
\ || e[0] =~# '.*pwsh$' || e[0] =~# '.*pwsh.exe$'
68-
let str1 = "'cmd \"arg1\" ''arg2'' !%# \\'"
69-
let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\# \\'"
68+
let str1 = "'cmd \"arg1\" ''arg2'' !%# \\'' \\! \\% \\#'"
69+
let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\# \\'' \\\\! \\\\% \\\\#'"
7070
elseif e[0] =~# '.*fish$' || e[0] =~# '.*fish.exe$'
71-
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\\\'"
72-
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\\\'"
71+
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\\\'\\'' \\\\! \\\\% \\\\#'"
72+
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\\\'\\'' \\\\\\! \\\\\\% \\\\\\#'"
7373
else
74-
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\'"
75-
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\'"
74+
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\'\\'' \\! \\% \\#'"
75+
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\'\\'' \\\\! \\\\% \\\\#'"
7676
endif
77-
call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%# \\"), e[0])
78-
call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%# \\", 1), e[0])
77+
call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%# \\' \\! \\% \\#"), e[0])
78+
call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%# \\' \\! \\% \\#", 1), e[0])
7979

8080
" Try running an external command with the shell.
8181
if executable(e[0])

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3393,
758760
/**/
759761
3392,
760762
/**/

0 commit comments

Comments
 (0)