1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 13:33:52 +01:00

extra paranoia for empty prefix/suffix in completion matching (11374)

This commit is contained in:
Sven Wischnowsky 2000-05-15 11:55:38 +00:00
parent 948262ba28
commit 8272394e7e
2 changed files with 7 additions and 4 deletions

@ -4,6 +4,9 @@
2000-05-15 Sven Wischnowsky <wischnow@zsh.org>
* 11374: Src/Zle/compcore.c: extra paranoia for empty
prefix/suffix in completion matching
* 11368: Src/utils.c: fix for empty (s::) separator and strings
with meta-characters

@ -1739,7 +1739,7 @@ addmatches(Cadata dat, char **argv)
llpl -= gfl;
}
}
s = dat->ppre ? dat->ppre : "";
s = dat->ppre ? dat->ppre : dupstring("");
if ((ml = match_str(lpre, s, &bpl, 0, NULL, 0, 0, 1)) >= 0) {
if (matchsubs) {
Cline tmp = get_cline(NULL, 0, NULL, 0, NULL, 0, 0);
@ -1757,14 +1757,14 @@ addmatches(Cadata dat, char **argv)
bpadd = strlen(s) - ml;
} else {
if (llpl <= lpl && strpfx(lpre, s))
lpre = "";
lpre = dupstring("");
else if (llpl > lpl && strpfx(s, lpre))
lpre += lpl;
else
*argv = NULL;
bcp = lpl;
}
s = dat->psuf ? dat->psuf : "";
s = dat->psuf ? dat->psuf : dupstring("");
if ((ml = match_str(lsuf, s, &bsl, 0, NULL, 1, 0, 1)) >= 0) {
if (matchsubs) {
Cline tmp = get_cline(NULL, 0, NULL, 0, NULL, 0, CLF_SUF);
@ -1782,7 +1782,7 @@ addmatches(Cadata dat, char **argv)
bsadd = strlen(s) - ml;
} else {
if (llsl <= lsl && strsfx(lsuf, s))
lsuf = "";
lsuf = dupstring("");
else if (llsl > lsl && strsfx(s, lsuf))
lsuf[llsl - lsl] = '\0';
else