about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-07 13:25:32 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-07 13:25:32 +0000
commitb0b33a41a1d2071ee689baaef312b2bd1ed50c13 (patch)
tree1d30fe536a5564dca2dd7cb86207885302773a1f /Src
parent25ca4f8792b99cc127f04ad059e0c66cb6e0face (diff)
downloadzsh-b0b33a41a1d2071ee689baaef312b2bd1ed50c13.tar.gz
zsh-b0b33a41a1d2071ee689baaef312b2bd1ed50c13.tar.xz
zsh-b0b33a41a1d2071ee689baaef312b2bd1ed50c13.zip
try to get the tests for `strings long enough' right in anchor matching code (11796)
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/compmatch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index 60a2fe7b9..6e7ded42c 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -535,7 +535,8 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 		    }
 		    /* Give up if we don't have enough characters for the
 		     * line-string and the anchor. */
-		    if (ll < llen + alen || lw < alen + aol)
+		    if (ll < llen + alen ||
+			(sfx ? (lw < alen + aol) : (lw < alen || iw < aol)))
 			continue;
 
 		    if (mp->flags & CMF_LEFT) {
@@ -571,7 +572,8 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 		     * string matched by the `*'. */
 		    if (sfx && (savl = l[-(llen + zoff)]))
 			l[-(llen + zoff)] = '\0';
-		    for (t = 0, tp = w, ct = 0, ict = lw - alen + 1;
+		    for (t = 0, tp = w, ct = 0,
+			     ict = lw - alen + 1 - (sfx ? aol : 0);
 			 ict;
 			 tp += add, ct++, ict--) {
 			if ((both &&