about summary refs log tree commit diff
path: root/Src/Zle/compcore.c
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-29 12:42:59 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-29 12:42:59 +0000
commitcd38cd40f7f81bee21c14157fc45540d538965bd (patch)
tree4bbc9d4d36187365d498ee632d9715cc0316a110 /Src/Zle/compcore.c
parentd22ee9a5ba4fcedc63b63a0ab904b86471fcad56 (diff)
downloadzsh-cd38cd40f7f81bee21c14157fc45540d538965bd.tar.gz
zsh-cd38cd40f7f81bee21c14157fc45540d538965bd.tar.xz
zsh-cd38cd40f7f81bee21c14157fc45540d538965bd.zip
matching bugs with patterns with two anchors (11634)
Diffstat (limited to 'Src/Zle/compcore.c')
-rw-r--r--Src/Zle/compcore.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 38cbe03a2..4fdfaa159 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -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);