aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Cox <dev@jasoncarloscox.com>2021-09-01 21:46:27 -0600
committerJason Cox <dev@jasoncarloscox.com>2021-09-02 13:07:29 -0600
commitd3c6f1ebbb528dd526daa6b3cbf3007d65f2af17 (patch)
treed702ec1417027ceb49af412d957d67d57535feee
parent85ba41a4b343d0a8fe6d3d5af90a74640220f5cb (diff)
downloadrneovim-d3c6f1ebbb528dd526daa6b3cbf3007d65f2af17.tar.gz
rneovim-d3c6f1ebbb528dd526daa6b3cbf3007d65f2af17.tar.bz2
rneovim-d3c6f1ebbb528dd526daa6b3cbf3007d65f2af17.zip
vim-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 vim/vim#8827) https://github.com/vim/vim/commit/6631597452d4644f485a09e4036d117e5f91de70
-rw-r--r--src/nvim/strings.c1
-rw-r--r--src/nvim/testdir/test_functions.vim8
2 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index 33310701d5..79a3db4843 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -278,6 +278,7 @@ char_u *vim_strsave_shellescape(const char_u *string,
if (*p == '\\' && fish_like) {
*d++ = '\\';
*d++ = *p++;
+ continue;
}
MB_COPY_CHAR(p, d);
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index c964f7aea4..b35a210055 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -1174,6 +1174,14 @@ func Test_shellescape()
call assert_equal("'te\\\\xt'", shellescape("te\\xt"))
call assert_equal("'te\\\\xt'", shellescape("te\\xt", 1))
+ call assert_equal("'te\\\\'\\''xt'", shellescape("te\\'xt"))
+ call assert_equal("'te\\\\'\\''xt'", shellescape("te\\'xt", 1))
+ call assert_equal("'te\\\\!xt'", shellescape("te\\!xt"))
+ call assert_equal("'te\\\\\\!xt'", shellescape("te\\!xt", 1))
+ call assert_equal("'te\\\\%xt'", shellescape("te\\%xt"))
+ call assert_equal("'te\\\\\\%xt'", shellescape("te\\%xt", 1))
+ call assert_equal("'te\\\\#xt'", shellescape("te\\#xt"))
+ call assert_equal("'te\\\\\\#xt'", shellescape("te\\#xt", 1))
let &shell = save_shell
endfunc