mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-10-02 08:51:18 +02:00
21045: fix some uses of Meta characters in completion
This commit is contained in:
parent
f1d0ca4d80
commit
24699f961d
@ -1,3 +1,8 @@
|
||||
2005-03-21 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 21045: Src/Zle/compcore.c, Src/Zle/complete.c: more places
|
||||
where completion didn't handled Meta characters.
|
||||
|
||||
2005-03-21 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* Stephen Rüger: 21019: Completion/Unix/Command/_mpc:
|
||||
|
@ -1532,8 +1532,8 @@ set_comp_sep(void)
|
||||
untokenize(ss);
|
||||
compsuffix = ztrdup(ss);
|
||||
}
|
||||
if ((i = strlen(compprefix)) &&
|
||||
compprefix[i - 1] == '\\' && compprefix[i - 2] != '\\')
|
||||
if ((i = strlen(compprefix)) > 1 && compprefix[i - 1] == '\\' &&
|
||||
compprefix[i - 2] != '\\' && compprefix[i - 2] != Meta)
|
||||
compprefix[i - 1] = '\0';
|
||||
|
||||
tmp = tricat(compqiprefix, compiprefix, multiquote(qp, 1));
|
||||
|
@ -821,18 +821,32 @@ do_comp_vars(int test, int na, char *sa, int nb, char *sb, int mod)
|
||||
add = -1;
|
||||
} else {
|
||||
p = compprefix + 1;
|
||||
if (*p == Meta)
|
||||
p++;
|
||||
add = 1;
|
||||
}
|
||||
for (; l; l--, p += add) {
|
||||
for (;;) {
|
||||
sav = *p;
|
||||
*p = '\0';
|
||||
test = pattry(pp, compprefix);
|
||||
*p = sav;
|
||||
if (test && !--na)
|
||||
break;
|
||||
}
|
||||
if (!l)
|
||||
if (add > 0) {
|
||||
if (p == compprefix + l)
|
||||
return 0;
|
||||
if (*p == Meta)
|
||||
p += 2;
|
||||
else
|
||||
p++;
|
||||
} else {
|
||||
if (p == compprefix)
|
||||
return 0;
|
||||
p--;
|
||||
if (p > compprefix && p[-1] == Meta)
|
||||
p--;
|
||||
}
|
||||
}
|
||||
if (mod)
|
||||
ignore_prefix(p - compprefix);
|
||||
} else {
|
||||
@ -847,14 +861,30 @@ do_comp_vars(int test, int na, char *sa, int nb, char *sb, int mod)
|
||||
add = 1;
|
||||
} else {
|
||||
p = compsuffix + l - 1;
|
||||
if (p > compsuffix && p[-1] == Meta)
|
||||
p--;
|
||||
add = -1;
|
||||
}
|
||||
for (; l; l--, p += add)
|
||||
for (;;) {
|
||||
if (pattry(pp, p) && !--na)
|
||||
break;
|
||||
|
||||
if (!l)
|
||||
if (add > 0) {
|
||||
if (p == compsuffix + l)
|
||||
return 0;
|
||||
if (*p == Meta)
|
||||
p += 2;
|
||||
else
|
||||
p++;
|
||||
} else {
|
||||
if (p == compsuffix)
|
||||
return 0;
|
||||
p--;
|
||||
if (p > compsuffix && p[-1] == Meta)
|
||||
p--;
|
||||
}
|
||||
}
|
||||
|
||||
if (mod)
|
||||
ignore_suffix(ol - (p - compsuffix));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user