about summary refs log tree commit diff
path: root/Src/Zle/compresult.c
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-01-10 09:24:45 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-01-10 09:24:45 +0000
commit9af83c6c2a54f479864698762c4a3cab5aba2fa8 (patch)
tree9d1c431a69be68ac1e4bf295624bf9d6f039d09f /Src/Zle/compresult.c
parent4a376d7250e899851f0bbd68898f619d750459c4 (diff)
downloadzsh-9af83c6c2a54f479864698762c4a3cab5aba2fa8.tar.gz
zsh-9af83c6c2a54f479864698762c4a3cab5aba2fa8.tar.xz
zsh-9af83c6c2a54f479864698762c4a3cab5aba2fa8.zip
fix cursor positioning with partial-word match specs using `**' (13336)
Diffstat (limited to 'Src/Zle/compresult.c')
-rw-r--r--Src/Zle/compresult.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index f30d8259a..287e1509f 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -163,13 +163,14 @@ static char *
 cline_str(Cline l, int ins, int *csp)
 {
     Cline s;
-    int ocs = cs, ncs, pcs, scs, pm, pmax, pmm, sm, smax, smm, d, dm, mid;
+    int ocs = cs, ncs, pcs, scs;
+    int pm, pmax, pmm, pma, sm, smax, smm, sma, d, dm, mid;
     int i, j, li = 0, cbr;
     Brinfo brp, brs;
 
     l = cut_cline(l);
 
-    pmm = smm = dm = pcs = scs = 0;
+    pmm = pma = smm = sma = dm = pcs = scs = 0;
     pm = pmax = sm = smax = d = mid = cbr = -1;
     brp = brs = NULL;
 
@@ -242,9 +243,11 @@ cline_str(Cline l, int ins, int *csp)
 	/* Remember the position if this is the first prefix with
 	 * missing characters. */
 	if ((l->flags & CLF_MISS) && !(l->flags & CLF_SUF) &&
-	    ((pmax < (l->min - l->max) && (!pmm || (l->flags & CLF_MATCHED))) ||
+	    (((pmax < (l->max - l->min) || (pma && l->max != l->min)) &&
+	      (!pmm || (l->flags & CLF_MATCHED))) ||
 	     ((l->flags & CLF_MATCHED) && !pmm))) {
-	    pm = cs; pmax = l->min - l->max; pmm = l->flags & CLF_MATCHED;
+	    pm = cs; pmax = l->max - l->min; pmm = l->flags & CLF_MATCHED;
+	    pma = ((l->prefix || l->suffix) && l->min == cline_sublen(l));
 	}
 	if (ins) {
 	    int ocs, bl;
@@ -289,10 +292,11 @@ cline_str(Cline l, int ins, int *csp)
 	    if (l->flags & CLF_MID)
 		mid = cs;
 	    else if ((l->flags & CLF_SUF) && 
-		     ((smax < (l->min - l->max) &&
+		     (((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;
+		sma = ((l->prefix || l->suffix) && l->min == cline_sublen(l));
 	    }
 	}
 	if (ins) {