about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Src/Zle/compmatch.c17
2 files changed, 16 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 86cd7cb17..f2376b878 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-29  Peter Stephenson  <pws@csr.com>
+
+	* 26466: Src/Zle/compmatch.c: with suffix, bld_line() got
+	the arithmetic over patterns wrong.
+
 2009-01-28  Peter Stephenson  <pws@csr.com>
 
 	* Greg Klanderman: 26465: Doc/Zsh/zle.yo, Src/Zle/zle_keymap.c:
@@ -11023,5 +11028,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4529 $                         
+* $Revision: 1.4530 $                         
 *****************************************************
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index c4523ae47..b59f5a2e1 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -1818,10 +1818,12 @@ bld_line(Cmatcher mp, ZLE_STRING_T line, char *mword, char *word,
 
 	if (sfx) {
 	    wp = wordcp - 1;
-	    curgenpat--;
-	} else
+	    tmpgenpat = curgenpat - 1;
+	} else {
+	    tmpgenpat = curgenpat;
 	    wp = wordcp;
-	if (pattern_match1(curgenpat, *wp, &wmtp))
+	}
+	if (pattern_match1(tmpgenpat, *wp, &wmtp))
 	{
 	    convchar_t lchr;
 	    /*
@@ -1831,8 +1833,8 @@ bld_line(Cmatcher mp, ZLE_STRING_T line, char *mword, char *word,
 	     * else if it's generic, keep the word character,
 	     * since we have no choice.
 	     */
-	    if (curgenpat->tp == CPAT_CHAR)
-		lchr = curgenpat->u.chr;
+	    if (tmpgenpat->tp == CPAT_CHAR)
+		lchr = tmpgenpat->u.chr;
 	    else
 		lchr = *wp;
 
@@ -1845,9 +1847,10 @@ bld_line(Cmatcher mp, ZLE_STRING_T line, char *mword, char *word,
 	    wlen--;
 	    rl++;
 
-	    if (sfx)
+	    if (sfx) {
 		wordcp = wp;
-	    else {
+		curgenpat = tmpgenpat;
+	    } else {
 		if (llen)
 		    curgenpat++;
 		wordcp++;