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)
6631597452
This commit is contained in:
Jason Cox
2021-09-01 21:46:27 -06:00
parent 85ba41a4b3
commit d3c6f1ebbb
2 changed files with 9 additions and 0 deletions

View File

@@ -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);

View File

@@ -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