Mercurial > vim
changeset 1700:9e1cefec84dd v7.2c.002
updated for version 7.2c-002
author | vimboss |
---|---|
date | Fri, 08 Aug 2008 10:59:17 +0000 |
parents | 9d74e2f433c0 |
children | 4577899b8ff1 |
files | runtime/doc/eval.txt src/ex_getln.c src/version.c |
diffstat | 3 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2832,11 +2832,13 @@ fnameescape({string}) *fnameescape() For most systems the characters escaped are " \t\n*?[{`$\\%#'\"|!<". For systems where a backslash appears in a filename, it depends on the value of 'isfname'. + A leading '+' and '>' is also escaped (special after |:edit| + and |:write|). And a "-" by itself (special after |:cd|). Example: > - :let fname = 'some str%nge|name' + :let fname = '+some str%nge|name' :exe "edit " . fnameescape(fname) < results in executing: > - edit some\ str\%nge\|name + edit \+some\ str\%nge\|name fnamemodify({fname}, {mods}) *fnamemodify()* Modify file name {fname} according to {mods}. {mods} is a
--- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -3717,7 +3717,7 @@ vim_strsave_fnameescape(fname, shell) if ((*p != '[' && *p != '{') || !vim_isfilec(*p)) buf[j++] = *p; buf[j] = NUL; - return vim_strsave_escaped(fname, buf); + p = vim_strsave_escaped(fname, buf); #else p = vim_strsave_escaped(fname, shell ? SHELL_ESC_CHARS : PATH_ESC_CHARS); if (shell && csh_like_shell() && p != NULL) @@ -3730,8 +3730,14 @@ vim_strsave_fnameescape(fname, shell) vim_free(p); p = s; } +#endif + + /* '>' and '+' are special at the start of some commands, e.g. ":edit" and + * ":write". "cd -" has a special meaning. */ + if (*p == '>' || *p == '+' || (*p == '-' && p[1] == NUL)) + escape_fname(&p); + return p; -#endif } /*