diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-09-01 14:31:51 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-09-01 14:31:51 +0200 |
commit | 6631597452d4644f485a09e4036d117e5f91de70 (patch) | |
tree | 9d618a8e92d8b43d548d62c86c456468ecee74cd | |
parent | b4d82e2a8d610c00139a74970df772eece2daf1c (diff) |
patch 8.2.3393: escaping for fish shell is skipping some charactersv8.2.3393
Problem: Escaping for fish shell is skipping some characters.
Solution: Escape character after backslash if needed. (Jason Cox,
closes #8827)
-rw-r--r-- | src/strings.c | 1 | ||||
-rw-r--r-- | src/testdir/test_shell.vim | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 13 insertions, 10 deletions
diff --git a/src/strings.c b/src/strings.c index 0c9e20d176..d2d37d80f6 100644 --- a/src/strings.c +++ b/src/strings.c @@ -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); diff --git a/src/testdir/test_shell.vim b/src/testdir/test_shell.vim index fa11f08d72..a6aa10ea25 100644 --- a/src/testdir/test_shell.vim +++ b/src/testdir/test_shell.vim @@ -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]) diff --git a/src/version.c b/src/version.c index 9f67d7964d..3a16ddad81 100644 --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3393, +/**/ 3392, /**/ 3391, |