about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/comp1.c10
-rw-r--r--Src/Zle/compctl.c6
-rw-r--r--Src/Zle/zle_params.c14
-rw-r--r--Src/Zle/zle_refresh.c54
-rw-r--r--Src/Zle/zle_tricky.c5
5 files changed, 42 insertions, 47 deletions
diff --git a/Src/Zle/comp1.c b/Src/Zle/comp1.c
index f32e5f5c0..071a8e64a 100644
--- a/Src/Zle/comp1.c
+++ b/Src/Zle/comp1.c
@@ -100,11 +100,11 @@ int incompfunc;
 /* global variables for shell parameters in new style completion */
 
 /**/
-long compcurrent,
-     compnmatches,
-     compmatcher,
-     compmatchertot,
-     complistmax;
+zlong compcurrent,
+      compnmatches,
+      compmatcher,
+      compmatchertot,
+      complistmax;
 
 /**/
 char **compwords,
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index a06d558e3..217678c00 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -2270,7 +2270,7 @@ set_compstate(Param pm, HashTable ht)
 		    v.arr = NULL;
 		    v.pm = (Param) hn;
 		    if (cp->type == PM_INTEGER)
-			*((long *) cp->var) = getintvalue(&v);
+			*((zlong *) cp->var) = getintvalue(&v);
 		    else if ((str = getstrvalue(&v))) {
 			zsfree(*((char **) cp->var));
 			*((char **) cp->var) = ztrdup(str);
@@ -2289,7 +2289,7 @@ get_unambig(Param pm)
 }
 
 /**/
-static long
+static zlong
 get_unambig_curs(Param pm)
 {
     int c;
@@ -2342,7 +2342,7 @@ comp_wrapper(List list, FuncWrap w, char *name)
 	return 1;
     else {
 	char *orest, *opre, *osuf, *oipre, *oisuf, **owords;
-	long ocur;
+	zlong ocur;
 	unsigned int unset = 0, m, sm;
 	Param *pp;
 
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index d9fefe659..5c4feef50 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -101,8 +101,8 @@ makezleparams(int ro)
 		pm->gets.afn = (char **(*) _((Param))) zp->getfn;
 		break;
 	    case PM_INTEGER:
-		pm->sets.ifn = (void (*) _((Param, long))) zp->setfn;
-		pm->gets.ifn = (long (*) _((Param))) zp->getfn;
+		pm->sets.ifn = (void (*) _((Param, zlong))) zp->setfn;
+		pm->gets.ifn = (zlong (*) _((Param))) zp->getfn;
 		pm->ct = 10;
 		break;
 	}
@@ -146,7 +146,7 @@ get_buffer(Param pm)
 
 /**/
 static void
-set_cursor(Param pm, long x)
+set_cursor(Param pm, zlong x)
 {
     if(x < 0)
 	cs = 0;
@@ -157,7 +157,7 @@ set_cursor(Param pm, long x)
 }
 
 /**/
-static long
+static zlong
 get_cursor(Param pm)
 {
     return cs;
@@ -264,20 +264,20 @@ get_keys(Param pm)
 
 /**/
 static void
-set_numeric(Param pm, long x)
+set_numeric(Param pm, zlong x)
 {
     zmult = x;
 }
 
 /**/
-static long
+static zlong
 get_numeric(Param pm)
 {
     return zmult;
 }
 
 /**/
-static long
+static zlong
 get_histno(Param pm)
 {
     return histline;
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 2377b70fa..9742ba501 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -881,20 +881,8 @@ moveto(int ln, int cl)
 	}
     }
 
-    if (cl == vcs)
-	return;
-
-/* choose cheapest movements for ttys without multiple movement capabilities -
-   do this now because it's easier (to code) */
-    if (cl <= vcs / 2) {
-	zputc('\r', shout);
-	vcs = 0;
-    }
-    if (vcs < cl)
-	tc_rightcurs(cl);
-    else if (vcs > cl)
-	tc_leftcurs(vcs - cl);
-    vcs = cl;
+    if (cl != vcs)
+        singmoveto(cl);
 }
 
 /**/
@@ -912,16 +900,17 @@ tcmultout(int cap, int multcap, int ct)
     return 0;
 }
 
+/* ct: number of characters to move across */
 /**/
 static void
-tc_rightcurs(int cl)
+tc_rightcurs(int ct)
 {
-    int ct,			/* number of characters to move across	    */
+    int cl,			/* ``desired'' absolute horizontal position */
 	i = vcs,		/* cursor position after initial movements  */
 	j;
     char *t;
 
-    ct = cl - vcs;
+    cl = ct + vcs;
 
 /* do a multright if we can - it's the most reliable */
     if (tccan(TCMULTRIGHT)) {
@@ -929,6 +918,13 @@ tc_rightcurs(int cl)
 	return;
     }
 
+/* do an absolute horizontal position if we can */
+    if (tccan(TCHORIZPOS)) {
+	tcoutarg(TCHORIZPOS, cl);
+	return;
+    }
+
+/* XXX: should really check "it" in termcap and use / and % */
 /* try tabs if tabs are non destructive and multright is not possible */
     if (!oxtabs && tccan(TCNEXTTAB) && ((vcs | 7) < cl)) {
 	i = (vcs | 7) + 1;
@@ -1137,21 +1133,19 @@ singmoveto(int pos)
 {
     if (pos == vcs)
 	return;
-    if (pos <= vcs / 2) {
+
+/* choose cheapest movements for ttys without multiple movement capabilities -
+   do this now because it's easier (to code) */
+
+    if ((!tccan(TCMULTLEFT) || pos == 0) && (pos <= vcs / 2)) {
 	zputc('\r', shout);
 	vcs = 0;
     }
-    if (pos < vcs) {
+
+    if (pos < vcs)
 	tc_leftcurs(vcs - pos);
-	vcs = pos;
-    }
-    if (pos > vcs) {
-	if (tcmultout(TCRIGHT, TCMULTRIGHT, pos - vcs))
-	    vcs = pos;
-	else
-	    while (pos > vcs) {
-		zputc(nbuf[0][vcs], shout);
-		vcs++;
-	    }
-    }
+    else if (pos > vcs)
+	tc_rightcurs(pos - vcs);
+
+    vcs = pos;
 }
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index bc6cff8b6..aadbaec6c 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -3723,7 +3723,8 @@ addmatches(Cadata dat, char **argv)
 		    }
 		}
 		if (!(dat->aflags & CAF_MATCH)) {
-		    ms = dupstring(s);
+		    ms = ((dat->aflags & CAF_QUOTE) ? dupstring(s) :
+			  quotename(s, NULL));
 		    lc = bld_parts(ms, sl, -1, NULL);
 		    isexact = 0;
 		} else if (!(ms = comp_match(lpre, lsuf, s, cp, &lc,
@@ -3734,7 +3735,7 @@ addmatches(Cadata dat, char **argv)
 		    continue;
 		}
 		if (doadd) {
-		    cm = add_match_data(isalt, ms, lc, dat->ipre, dat->ipre,
+		    cm = add_match_data(isalt, ms, lc, dat->ipre, NULL,
 					dat->isuf, dat->pre, dat->prpre,
 					dat->ppre, dat->psuf, dat->suf,
 					bpl, bsl, dat->flags, isexact);