diff options
author | Bram Moolenaar <Bram@vim.org> | 2007-08-18 15:47:34 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2007-08-18 15:47:34 +0000 |
commit | 6529c101c3fe162a581d80e3ae9bd339e43a6606 (patch) | |
tree | 5b6ddfa0caa544cc44ce91c029bedb58c0c9de4e /src/ex_docmd.c | |
parent | 7baa45dbbfd22f15db7c312d2fef40d1d3c9a92a (diff) | |
download | vim-git-6529c101c3fe162a581d80e3ae9bd339e43a6606.tar.gz |
updated for version 7.1-081v7.1.081
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 5e6379197..73a990c72 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -3281,39 +3281,64 @@ set_one_cmd_context(xp, buff) if (ea.argt & XFILE) { - int in_quote = FALSE; - char_u *bow = NULL; /* Beginning of word */ + int c; + int in_quote = FALSE; + char_u *bow = NULL; /* Beginning of word */ /* * Allow spaces within back-quotes to count as part of the argument * being expanded. */ xp->xp_pattern = skipwhite(arg); - for (p = xp->xp_pattern; *p; ) + p = xp->xp_pattern; + while (*p != NUL) { - if (*p == '\\' && p[1] != NUL) +#ifdef FEAT_MBYTE + if (has_mbyte) + c = mb_ptr2char(p); + else +#endif + c = *p; + if (c == '\\' && p[1] != NUL) ++p; + else if (c == '`') + { + if (!in_quote) + { + xp->xp_pattern = p; + bow = p + 1; + } + in_quote = !in_quote; + } #ifdef SPACE_IN_FILENAME - else if (vim_iswhite(*p) && (!(ea.argt & NOSPC) || usefilter)) + else if (!vim_isfilec(c) && (!(ea.argt & NOSPC) || usefilter)) #else - else if (vim_iswhite(*p)) + else if (!vim_isfilec(c)) #endif { - p = skipwhite(p); + while (*p != NUL) + { +#ifdef FEAT_MBYTE + if (has_mbyte) + c = mb_ptr2char(p); + else +#endif + c = *p; + if (c == '`' || vim_isfilec(c)) + break; +#ifdef FEAT_MBYTE + if (has_mbyte) + len = (*mb_ptr2len)(p); + else +#endif + len = 1; + mb_ptr_adv(p); + } if (in_quote) bow = p; else xp->xp_pattern = p; - --p; - } - else if (*p == '`') - { - if (!in_quote) - { - xp->xp_pattern = p; - bow = p + 1; - } - in_quote = !in_quote; + p -= len; } mb_ptr_adv(p); } |