mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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)
This commit is contained in:
@@ -281,6 +281,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline)
|
|||||||
{
|
{
|
||||||
*d++ = '\\';
|
*d++ = '\\';
|
||||||
*d++ = *p++;
|
*d++ = *p++;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
MB_COPY_CHAR(p, d);
|
MB_COPY_CHAR(p, d);
|
||||||
|
@@ -61,21 +61,21 @@ func Test_shell_options()
|
|||||||
for e in shells
|
for e in shells
|
||||||
exe 'set shell=' .. e[0]
|
exe 'set shell=' .. e[0]
|
||||||
if e[0] =~# '.*csh$' || e[0] =~# '.*csh.exe$'
|
if e[0] =~# '.*csh$' || e[0] =~# '.*csh.exe$'
|
||||||
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%# \\'"
|
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%# \\'\\'' \\\\! \\% \\#'"
|
||||||
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\# \\'"
|
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\# \\'\\'' \\\\\\! \\\\% \\\\#'"
|
||||||
elseif e[0] =~# '.*powershell$' || e[0] =~# '.*powershell.exe$'
|
elseif e[0] =~# '.*powershell$' || e[0] =~# '.*powershell.exe$'
|
||||||
\ || e[0] =~# '.*pwsh$' || e[0] =~# '.*pwsh.exe$'
|
\ || e[0] =~# '.*pwsh$' || e[0] =~# '.*pwsh.exe$'
|
||||||
let str1 = "'cmd \"arg1\" ''arg2'' !%# \\'"
|
let str1 = "'cmd \"arg1\" ''arg2'' !%# \\'' \\! \\% \\#'"
|
||||||
let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\# \\'"
|
let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\# \\'' \\\\! \\\\% \\\\#'"
|
||||||
elseif e[0] =~# '.*fish$' || e[0] =~# '.*fish.exe$'
|
elseif e[0] =~# '.*fish$' || e[0] =~# '.*fish.exe$'
|
||||||
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\\\'"
|
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\\\'\\'' \\\\! \\\\% \\\\#'"
|
||||||
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\\\'"
|
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\\\'\\'' \\\\\\! \\\\\\% \\\\\\#'"
|
||||||
else
|
else
|
||||||
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\'"
|
let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\'\\'' \\! \\% \\#'"
|
||||||
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\'"
|
let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\'\\'' \\\\! \\\\% \\\\#'"
|
||||||
endif
|
endif
|
||||||
call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%# \\"), e[0])
|
call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%# \\' \\! \\% \\#"), e[0])
|
||||||
call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%# \\", 1), e[0])
|
call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%# \\' \\! \\% \\#", 1), e[0])
|
||||||
|
|
||||||
" Try running an external command with the shell.
|
" Try running an external command with the shell.
|
||||||
if executable(e[0])
|
if executable(e[0])
|
||||||
|
@@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3393,
|
||||||
/**/
|
/**/
|
||||||
3392,
|
3392,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user