1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-10 12:40:58 +02:00

39372: compadd: Match -P prefix all-or-nothing rather than greedily.

This commit is contained in:
Daniel Shahaf 2016-09-17 06:32:58 +00:00
parent c8de0af359
commit bd94e13f34
2 changed files with 12 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2016-09-20 Daniel Shahaf <d.s@daniel.shahaf.name>
* 39372: Src/Zle/compcore.c: compadd: Match -P prefix
all-or-nothing rather than greedily.
2016-09-19 Barton E. Schaefer <schaefer@zsh.org>
* 39381: Src/exec.c: handle save/restore of variable values when

View file

@ -2029,7 +2029,7 @@ addmatches(Cadata dat, char **argv)
char **aign = NULL, **dparr = NULL, *oaq = autoq, *oppre = dat->ppre;
char *oqp = qipre, *oqs = qisuf, qc, **disp = NULL, *ibuf = NULL;
char **arrays = NULL;
int lpl, lsl, pl, sl, bcp = 0, bcs = 0, bpadd = 0, bsadd = 0;
int lpl, lsl, sl, bcp = 0, bcs = 0, bpadd = 0, bsadd = 0;
int ppl = 0, psl = 0, ilen = 0;
int llpl = 0, llsl = 0, nm = mnum, gflags = 0, ohp = haspattern;
int isexact, doadd, ois = instring, oib = inbackt;
@ -2193,9 +2193,12 @@ addmatches(Cadata dat, char **argv)
/* Test if there is an existing -P prefix. */
if (dat->pre && *dat->pre) {
pl = pfxlen(dat->pre, lpre);
llpl -= pl;
lpre += pl;
int prefix_length = pfxlen(dat->pre, lpre);
if (dat->pre[prefix_length] == '\0') {
/* $compadd_args[-P] is a prefix of ${PREFIX}. */
llpl -= prefix_length;
lpre += prefix_length;
}
}
}
/* Now duplicate the strings we have from the command line. */