about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2004-02-10 02:30:14 +0000
committerWayne Davison <wayned@users.sourceforge.net>2004-02-10 02:30:14 +0000
commitba827bb22b43294438efafd87b9319eebd763f94 (patch)
treef85efc039e5948747896e6f7be64ce3e54804944
parent40678f6b666e36928b4ac0405f518db5b166c296 (diff)
downloadzsh-ba827bb22b43294438efafd87b9319eebd763f94.tar.gz
zsh-ba827bb22b43294438efafd87b9319eebd763f94.tar.xz
zsh-ba827bb22b43294438efafd87b9319eebd763f94.zip
Another fix in sub_match() to avoid allowing a partial-meta match
to occur (this time in the backwards scan).
-rw-r--r--Src/Zle/compmatch.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index 410078a7b..750b4cb58 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -1593,10 +1593,15 @@ sub_match(Cmdata md, char *str, int len, int sfx)
 	     l < len && l < md->len && p[ind] == q[ind];
 	     l++, p += add, q += add) {}
 
-	/* Make sure we don't end with a widowed Meta (which can only
-	 * happen in a forward scan). */
-	if (l && add == 1 && p[-1] == Meta)
-	    l--;
+	/* Make sure we don't end in the middle of a Meta sequence. */
+	if (add == 1) {
+	    if (l && p[-1] == Meta)
+		l--;
+	} else {
+	    if (l && ((l < len && p[-1] == Meta)
+		   || (l < md->len && q[-1] == Meta)))
+		l--;
+	}
 	if (l) {
 	    /* There was a common prefix, use it. */
 	    md->len -= l; len -= l;