mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-03 22:32:12 +02:00
matching bugs with patterns with two anchors (11634)
This commit is contained in:
parent
d22ee9a5ba
commit
cd38cd40f7
4 changed files with 25 additions and 4 deletions
|
@ -1,5 +1,8 @@
|
|||
2000-05-29 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 11634: Src/Zle/compcore.c, Src/Zle/compmatch.c, Src/Zle/compresult.c:
|
||||
matching bugs with patterns with two anchors
|
||||
|
||||
* 11631: Completion/Base/_arguments: keep information about things
|
||||
to complete in _arguments
|
||||
|
||||
|
|
|
@ -49,6 +49,11 @@ mod_export int dolastprompt;
|
|||
/**/
|
||||
mod_export int oldlist, oldins;
|
||||
|
||||
/* Original prefix/suffix lengths. Flag saying if they changed. */
|
||||
|
||||
/**/
|
||||
int origlpre, origlsuf, lenchanged;
|
||||
|
||||
/* This is used to decide when the cursor should be moved to the end of *
|
||||
* the inserted word: 0 - never, 1 - only when a single match is inserted, *
|
||||
* 2 - when a full match is inserted (single or menu), 3 - always. */
|
||||
|
@ -691,6 +696,11 @@ callcompfunc(char *s, char *fn)
|
|||
compqiprefix = ztrdup(qipre ? qipre : "");
|
||||
zsfree(compqisuffix);
|
||||
compqisuffix = ztrdup(qisuf ? qisuf : "");
|
||||
origlpre = (strlen(compqiprefix) + strlen(compiprefix) +
|
||||
strlen(compprefix));
|
||||
origlsuf = (strlen(compqisuffix) + strlen(compisuffix) +
|
||||
strlen(compsuffix));
|
||||
lenchanged = 0;
|
||||
compcurrent = (usea ? (clwpos + 1 - aadd) : 0);
|
||||
|
||||
zsfree(complist);
|
||||
|
@ -1700,6 +1710,11 @@ addmatches(Cadata dat, char **argv)
|
|||
lsuf = dupstring(compsuffix);
|
||||
llpl = strlen(lpre);
|
||||
llsl = strlen(lsuf);
|
||||
|
||||
if (llpl + strlen(compqiprefix) + strlen(lipre) != origlpre ||
|
||||
llsl + strlen(compqisuffix) + strlen(lisuf) != origlsuf)
|
||||
lenchanged = 1;
|
||||
|
||||
/* Test if there is an existing -P prefix. */
|
||||
if (dat->pre && *dat->pre) {
|
||||
pl = pfxlen(dat->pre, lpre);
|
||||
|
|
|
@ -473,7 +473,7 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
|
|||
bp = bp->next;
|
||||
}
|
||||
/*** This once was: `while (ll && lw)', but then ignored characters at
|
||||
* the end or not, well, ignored. */
|
||||
* the end were not, well, ignored. */
|
||||
while (ll) {
|
||||
|
||||
/* Hm, we unconditionally first tried the matchers for the cases
|
||||
|
@ -1859,8 +1859,10 @@ join_clines(Cline o, Cline n)
|
|||
if (!(o->flags & CLF_NEW) && (n->flags & CLF_NEW)) {
|
||||
Cline t, tn;
|
||||
|
||||
for (t = n; (tn = t->next) && (tn->flags & CLF_NEW); t = tn);
|
||||
if (tn && cmp_anchors(o, tn, 0)) {
|
||||
for (t = n; (tn = t->next) &&
|
||||
((tn->flags & CLF_NEW) || !cmp_anchors(o, tn, 0));
|
||||
t = tn);
|
||||
if (tn) {
|
||||
diff = sub_join(o, n, tn, 0);
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -656,7 +656,8 @@ do_ambiguous(void)
|
|||
/* Sometimes the different match specs used may result in a cline
|
||||
* that gives an empty string. If that happened, we re-insert the
|
||||
* old string. Unless there were matches added with -U, that is. */
|
||||
if (!(lastend - wb) && !hasunmatched) {
|
||||
|
||||
if (lastend < we && !lenchanged && !hasunmatched) {
|
||||
cs = wb;
|
||||
foredel(lastend - wb);
|
||||
inststrlen(old, 0, we - wb);
|
||||
|
|
Loading…
Reference in a new issue