summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Src/Zle/compmatch.c26
-rw-r--r--Src/Zle/compresult.c4
-rw-r--r--Test/54compmatch.ztst2
4 files changed, 34 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 24f0b39a6..3f50de897 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-03-05  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 13565: Src/Zle/compmatch.c, Src/Zle/compresult.c,
+ 	Test/54compmatch.ztst: fix for matching control, try harder to
+ 	merge separately completed parts to avoid losing user-typed
+ 	characters
+	
 2001-03-04  Peter Stephenson  <pws@pwstephenson.fsnet.co.uk>
 
 	* Unposted: Etc/FAQ.yo: latest version.
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index 0bd8e82f3..45220a298 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -2001,8 +2001,7 @@ join_clines(Cline o, Cline n)
 		    else
 			oo = to;
 		    o = to;
-		}
-		if (tn) {
+
 		    diff = sub_join(o, n, tn, 0);
 
 		    o->flags |= CLF_MISS;
@@ -2064,6 +2063,29 @@ join_clines(Cline o, Cline n)
 			    }
 			    continue;
 			} else {
+			    for (tn = n; tn; tn = tn->next)
+				if ((tn->flags & CLF_NEW) ==
+				    (o->flags & CLF_NEW) &&
+				    cmp_anchors(tn, o, 1)) break;
+
+			    if (tn) {
+				if ((diff = sub_join(o, n, tn, 0))) {
+				    if (po) {
+					po->flags |= CLF_MISS;
+					po->max += diff;
+				    }
+				    else {
+					o->flags |= CLF_MISS;
+					o->max += diff;
+				    }
+				}
+				n = tn;
+				po = o;
+				o = o->next;
+				pn = n;
+				n = n->next;
+				continue;
+			    }
 			    if (o->flags & CLF_SUF)
 				break;
 
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index b2c240188..9b85948f9 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -253,7 +253,7 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 		opos = npos;
 		addlinknode(posl, (void *) ((long) npos));
 	    }
-	    if (((pmax < (l->max - l->min) || (pma && l->max != l->min)) &&
+	    if (((pmax <= (l->max - l->min) || (pma && l->max != l->min)) &&
 		 (!pmm || (l->flags & CLF_MATCHED))) ||
 		((l->flags & CLF_MATCHED) && !pmm)) {
 		pm = cs; pmax = l->max - l->min; pmm = l->flags & CLF_MATCHED;
@@ -307,7 +307,7 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 		    opos = npos;
 		    addlinknode(posl, (void *) ((long) npos));
 		}
-		if (((smax < (l->min - l->max) || (sma && l->max != l->min)) &&
+		if (((smax <= (l->min - l->max) || (sma && l->max != l->min)) &&
 		     (!smm || (l->flags & CLF_MATCHED))) ||
 		    ((l->flags & CLF_MATCHED) && !smm)) {
 		    sm = cs; smax = l->min - l->max; smm = l->flags & CLF_MATCHED;
diff --git a/Test/54compmatch.ztst b/Test/54compmatch.ztst
index ac33628ad..8ffbe6dda 100644
--- a/Test/54compmatch.ztst
+++ b/Test/54compmatch.ztst
@@ -570,7 +570,7 @@
  test_code $workers_11388_matcher workers_11388_list
  comptest $'tst :\t'
 0:Non-bug from workers 11388
->line: {tst }{.:}
+>line: {tst .:}{}
 >COMPADD:{}
 >INSERT_POSITIONS:{4:5:6}