Merge pull request #29102 from zeertzjq/vim-9.1.0449

vim-patch:9.1.{0449,0451}
This commit is contained in:
zeertzjq 2024-05-31 06:10:30 +08:00 committed by GitHub
commit 88fe467b19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -84,7 +84,7 @@ typedef struct {
/// Structure containing last search pattern and its attributes.
typedef struct {
char *pat; ///< The pattern (in allocated memory) or NULL.
size_t patlen; ///< The length of the patten (0 is pat is NULL).
size_t patlen; ///< The length of the pattern (0 if pat is NULL).
bool magic; ///< Magicness of the pattern.
bool no_scs; ///< No smartcase for this pattern.
Timestamp timestamp; ///< Time of the last change.

View File

@ -268,9 +268,9 @@ char *vim_strsave_shellescape(const char *string, bool do_special, bool do_newli
}
if (do_special && find_cmdline_var(p, &l) >= 0) {
*d++ = '\\'; // insert backslash
while (--l != SIZE_MAX) { // copy the var
*d++ = *p++;
}
memcpy(d, p, l); // copy the var
d += l;
p += l;
continue;
}
if (*p == '\\' && fish_like) {

View File

@ -119,6 +119,10 @@ func Test_shellescape()
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<cword>xt'", shellescape("te<cword>xt"))
call assert_equal("'te\\<cword>xt'", shellescape("te<cword>xt", 1))
call assert_equal("'te<cword>%xt'", shellescape("te<cword>%xt"))
call assert_equal("'te\\<cword>\\%xt'", shellescape("te<cword>%xt", 1))
call assert_equal("'te\nxt'", shellescape("te\nxt"))
call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1))