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)

e3846cf1eb

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2022-12-09 09:45:45 +08:00
committed by GitHub
parent ae5980ec79
commit 0483ee8254
2 changed files with 123 additions and 34 deletions

View File

@@ -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;