forked from aniani/vim
updated for version 7.4.191
Problem: Escaping a file name for shell commands can't be done without a function. Solution: Add the :S file name modifier.
This commit is contained in:
13
src/eval.c
13
src/eval.c
@@ -16950,7 +16950,7 @@ f_shellescape(argvars, rettv)
|
||||
typval_T *rettv;
|
||||
{
|
||||
rettv->vval.v_string = vim_strsave_shellescape(
|
||||
get_tv_string(&argvars[0]), non_zero_arg(&argvars[1]));
|
||||
get_tv_string(&argvars[0]), non_zero_arg(&argvars[1]), TRUE);
|
||||
rettv->v_type = VAR_STRING;
|
||||
}
|
||||
|
||||
@@ -24355,6 +24355,17 @@ repeat:
|
||||
}
|
||||
}
|
||||
|
||||
if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S')
|
||||
{
|
||||
p = vim_strsave_shellescape(*fnamep, FALSE, FALSE);
|
||||
if (p == NULL)
|
||||
return -1;
|
||||
vim_free(*bufp);
|
||||
*bufp = *fnamep = p;
|
||||
*fnamelen = (int)STRLEN(p);
|
||||
*usedlen += 2;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user