about summary refs log tree commit diff
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
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)
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/compmatch.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3ce390c64..211a2fa0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-06-07  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 11796: Src/Zle/compmatch.c: try to get the tests for `strings
+ 	long enough' right in anchor matching code
+	
 2000-06-07  Peter Stephenson  <pws@cambridgesiliconradio.com>
 
 	* 11711: Andrej Borsenkow: Test/ztst.zsh: Ignore diff output
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 &&