diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-09 09:45:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-09 09:45:45 +0800 |
commit | 0483ee825414ee02d0fc446c9bad4949b28e622f (patch) | |
tree | 53147d80c3094f34533bed85f68ea84d4abbef4d /src/nvim/cmdexpand.c | |
parent | ae5980ec797381cbaee7398a656bdb233f951981 (diff) | |
download | rneovim-0483ee825414ee02d0fc446c9bad4949b28e622f.tar.gz rneovim-0483ee825414ee02d0fc446c9bad4949b28e622f.tar.bz2 rneovim-0483ee825414ee02d0fc446c9bad4949b28e622f.zip |
vim-patch:8.2.4387: command line completion doesn't always work properly (#21352)
Problem: Command line completion doesn't always work properly.
Solution: Adjust triggering after a "|". Add more tests. (Yegappan
Lakshmanan, closes vim/vim#9779)
https://github.com/vim/vim/commit/e3846cf1ebdc4af0b39885153b4703f71a9b919e
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/cmdexpand.c')
-rw-r--r-- | src/nvim/cmdexpand.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index 933ad93964..d1a56feef4 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -1551,16 +1551,20 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons // Skip "from" part. arg++; arg = (const char *)skip_regexp((char *)arg, delim, magic_isset()); - } - // Skip "to" part. - while (arg[0] != NUL && (uint8_t)arg[0] != delim) { - if (arg[0] == '\\' && arg[1] != NUL) { + + if (arg[0] != NUL && arg[0] == delim) { + // Skip "to" part. arg++; + while (arg[0] != NUL && (uint8_t)arg[0] != delim) { + if (arg[0] == '\\' && arg[1] != NUL) { + arg++; + } + arg++; + } + if (arg[0] != NUL) { // Skip delimiter. + arg++; + } } - arg++; - } - if (arg[0] != NUL) { // Skip delimiter. - arg++; } while (arg[0] && strchr("|\"#", arg[0]) == NULL) { arg++; @@ -1591,7 +1595,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons arg = (const char *)skipwhite(arg + 1); // Check for trailing illegal characters. - if (*arg && strchr("|\"\n", *arg) == NULL) { + if (*arg == NUL || strchr("|\"\n", *arg) == NULL) { xp->xp_context = EXPAND_NOTHING; } else { return arg; |