Mercurial > vim
comparison src/ex_docmd.c @ 3711:169ccc471a8a v7.3.615
updated for version 7.3.615
Problem: Completion for a user command does not recognize backslash before
a space.
Solution: Recognize escaped characters. (Yasuhiro Matsumoto)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 25 Jul 2012 17:22:23 +0200 |
parents | 8f98038a0bf3 |
children | 73db39ca1877 |
comparison
equal
deleted
inserted
replaced
3710:40b720ad5b7e | 3711:169ccc471a8a |
---|---|
3388 if (!(ea.argt & EXTRA) && *arg != NUL && | 3388 if (!(ea.argt & EXTRA) && *arg != NUL && |
3389 vim_strchr((char_u *)"|\"", *arg) == NULL) | 3389 vim_strchr((char_u *)"|\"", *arg) == NULL) |
3390 return NULL; | 3390 return NULL; |
3391 | 3391 |
3392 /* Find start of last argument (argument just before cursor): */ | 3392 /* Find start of last argument (argument just before cursor): */ |
3393 p = buff + STRLEN(buff); | 3393 p = buff; |
3394 while (p != arg && *p != ' ' && *p != TAB) | |
3395 p--; | |
3396 if (*p == ' ' || *p == TAB) | |
3397 p++; | |
3398 xp->xp_pattern = p; | 3394 xp->xp_pattern = p; |
3395 len = STRLEN(buff); | |
3396 while (*p && p < buff + len) | |
3397 { | |
3398 if (*p == ' ' || *p == TAB) | |
3399 { | |
3400 /* argument starts after a space */ | |
3401 xp->xp_pattern = ++p; | |
3402 } | |
3403 else | |
3404 { | |
3405 if (*p == '\\' && *(p + 1) != NUL) | |
3406 ++p; /* skip over escaped character */ | |
3407 mb_ptr_adv(p); | |
3408 } | |
3409 } | |
3399 | 3410 |
3400 if (ea.argt & XFILE) | 3411 if (ea.argt & XFILE) |
3401 { | 3412 { |
3402 int c; | 3413 int c; |
3403 int in_quote = FALSE; | 3414 int in_quote = FALSE; |
3819 if (compl == EXPAND_COMMANDS) | 3830 if (compl == EXPAND_COMMANDS) |
3820 return arg; | 3831 return arg; |
3821 if (compl == EXPAND_MAPPINGS) | 3832 if (compl == EXPAND_MAPPINGS) |
3822 return set_context_in_map_cmd(xp, (char_u *)"map", | 3833 return set_context_in_map_cmd(xp, (char_u *)"map", |
3823 arg, forceit, FALSE, FALSE, CMD_map); | 3834 arg, forceit, FALSE, FALSE, CMD_map); |
3824 while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) | 3835 /* Find start of last argument. */ |
3825 arg = xp->xp_pattern + 1; | 3836 p = arg; |
3837 while (*p) | |
3838 { | |
3839 if (*p == ' ') | |
3840 { | |
3841 /* argument starts after a space */ | |
3842 arg = p + 1; | |
3843 } | |
3844 else | |
3845 { | |
3846 if (*p == '\\' && *(p + 1) != NUL) | |
3847 ++p; /* skip over escaped character */ | |
3848 mb_ptr_adv(p); | |
3849 } | |
3850 } | |
3826 xp->xp_pattern = arg; | 3851 xp->xp_pattern = arg; |
3827 } | 3852 } |
3828 xp->xp_context = compl; | 3853 xp->xp_context = compl; |
3829 } | 3854 } |
3830 break; | 3855 break; |