diff options
-rw-r--r-- | src/nvim/strings.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 8 |
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 |