about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-01-14 13:04:47 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-01-14 13:04:47 +0000
commit88a37cc187c0f6c5b7130a943c7ddd87474a0f69 (patch)
treed1f3fa3261e2f436ef5fc4fd6690b12a448fd11a /Src/Zle
parente38389d83e7962759138763a038ed9f2f8e23ec9 (diff)
downloadzsh-88a37cc187c0f6c5b7130a943c7ddd87474a0f69.tar.gz
zsh-88a37cc187c0f6c5b7130a943c7ddd87474a0f69.tar.xz
zsh-88a37cc187c0f6c5b7130a943c7ddd87474a0f69.zip
c.f. 20675: improve zle as a basis for Unicode.
unposted: update version to 4.2.3-dev-1
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/compcore.c66
-rw-r--r--Src/Zle/compctl.c62
-rw-r--r--Src/Zle/complist.c90
-rw-r--r--Src/Zle/compresult.c246
-rw-r--r--Src/Zle/deltochar.c16
-rw-r--r--Src/Zle/zle.h5
-rw-r--r--Src/Zle/zle_hist.c184
-rw-r--r--Src/Zle/zle_main.c47
-rw-r--r--Src/Zle/zle_misc.c208
-rw-r--r--Src/Zle/zle_move.c166
-rw-r--r--Src/Zle/zle_params.c46
-rw-r--r--Src/Zle/zle_refresh.c18
-rw-r--r--Src/Zle/zle_tricky.c309
-rw-r--r--Src/Zle/zle_utils.c127
-rw-r--r--Src/Zle/zle_vi.c262
-rw-r--r--Src/Zle/zle_word.c232
16 files changed, 1062 insertions, 1022 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 8fd224bd9..59443a8fa 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -329,7 +329,7 @@ do_completion(UNUSED(Hookdef dummy), Compldat dat)
 		      (isset(LISTPACKED) ? "packed rows" : "rows") :
 		      (isset(LISTPACKED) ? "packed" : ""));
     startauto = isset(AUTOMENU);
-    movetoend = ((cs == we || isset(ALWAYSTOEND)) ? 2 : 1);
+    movetoend = ((zlecs == we || isset(ALWAYSTOEND)) ? 2 : 1);
     showinglist = 0;
     hasmatched = hasunmatched = 0;
     minmlen = 1000000;
@@ -341,10 +341,10 @@ do_completion(UNUSED(Hookdef dummy), Compldat dat)
     /* Make sure we have the completion list and compctl. */
     if (makecomplist(s, incmd, lst)) {
 	/* Error condition: feeeeeeeeeeeeep(). */
-	cs = 0;
-	foredel(ll);
+	zlecs = 0;
+	foredel(zlell);
 	inststr(origline);
-	cs = origcs;
+	zlecs = origcs;
 	clearlist = 1;
 	ret = 1;
 	minfo.cur = NULL;
@@ -366,10 +366,10 @@ do_completion(UNUSED(Hookdef dummy), Compldat dat)
 	ret = selfinsert(zlenoargs);
     else if (!useline && uselist) {
 	/* All this and the guy only wants to see the list, sigh. */
-	cs = 0;
-	foredel(ll);
+	zlecs = 0;
+	foredel(zlell);
 	inststr(origline);
-	cs = origcs;
+	zlecs = origcs;
 	showinglist = -2;
     } else if (useline == 2 && nmatches > 1) {
 	do_allmatches(1);
@@ -414,10 +414,10 @@ do_completion(UNUSED(Hookdef dummy), Compldat dat)
 	invalidatelist();
 	if (forcelist)
 	    clearlist = 1;
-	cs = 0;
-	foredel(ll);
+	zlecs = 0;
+	foredel(zlell);
 	inststr(origline);
-	cs = origcs;
+	zlecs = origcs;
     }
     /* Print the explanation strings if needed. */
     if (!showinglist && validlist && usemenu != 2 && uselist &&
@@ -430,9 +430,9 @@ do_completion(UNUSED(Hookdef dummy), Compldat dat)
     for (n = firstnode(matchers); n; incnode(n))
 	freecmatcher((Cmatcher) getdata(n));
 
-    ll = strlen((char *)line);
-    if (cs > ll)
-	cs = ll;
+    zlell = strlen((char *)zleline);
+    if (zlecs > zlell)
+	zlecs = zlell;
     popheap();
 
     return ret;
@@ -469,8 +469,8 @@ before_complete(UNUSED(Hookdef dummy), int *lst)
     /* We may have to reset the cursor to its position after the   *
      * string inserted by the last completion. */
 
-    if ((fromcomp & FC_INWORD) && (cs = lastend) > ll)
-	cs = ll;
+    if ((fromcomp & FC_INWORD) && (zlecs = lastend) > zlell)
+	zlecs = zlell;
 
     /* Check if we have to start a menu-completion (via automenu). */
 
@@ -499,10 +499,10 @@ after_complete(UNUSED(Hookdef dummy), int *dat)
 	    minfo.cur = NULL;
 	    if (ret >= 2) {
 		fixsuffix();
-		cs = 0;
-		foredel(ll);
+		zlecs = 0;
+		foredel(zlell);
 		inststr(origline);
-		cs = origcs;
+		zlecs = origcs;
 		if (ret == 2) {
 		    clearlist = 1;
 		    invalidatelist();
@@ -683,10 +683,10 @@ callcompfunc(char *s, char *fn)
 	    int l;
 
 	    compiprefix = (char *) zalloc((l = wb - parwb) + 1);
-	    memcpy(compiprefix, line + parwb, l);
+	    memcpy(compiprefix, zleline + parwb, l);
 	    compiprefix[l] = '\0';
 	    compisuffix = (char *) zalloc((l = parwe - we) + 1);
-	    memcpy(compisuffix, line + we, l);
+	    memcpy(compisuffix, zleline + we, l);
 	    compisuffix[l] = '\0';
 
 	    wb = parwb;
@@ -1152,7 +1152,7 @@ check_param(char *s, int set, int test)
 	    }
 	    /* And adjust wb, we, and offs again. */
 	    offs -= b - s;
-	    wb = cs - offs;
+	    wb = zlecs - offs;
 	    we = wb + e - b;
 	    ispar = (br >= 2 ? 2 : 1);
 	    b[we-wb] = '\0';
@@ -1273,11 +1273,11 @@ set_comp_sep(void)
     char *s = comp_str(&lip, &lp, 1);
     LinkList foo = newlinklist();
     LinkNode n;
-    int owe = we, owb = wb, ocs = cs, swb, swe, scs, soffs, ne = noerrs;
-    int tl, got = 0, i = 0, j, cur = -1, oll = ll, sl, css = 0;
+    int owe = we, owb = wb, ocs = zlecs, swb, swe, scs, soffs, ne = noerrs;
+    int tl, got = 0, i = 0, j, cur = -1, oll = zlell, sl, css = 0;
     int remq = 0, dq = 0, odq, sq = 0, osq, issq = 0, sqq = 0, lsq = 0, qa = 0;
     int ois = instring, oib = inbackt, noffs = lp, ona = noaliases;
-    char *tmp, *p, *ns, *ol = (char *) line, sav, *qp, *qs, *ts, qc = '\0';
+    char *tmp, *p, *ns, *ol = (char *) zleline, sav, *qp, *qs, *ts, qc = '\0';
 
     s += lip;
     wb += lip;
@@ -1295,7 +1295,7 @@ set_comp_sep(void)
     tmp = (char *) zhalloc(tl = 3 + strlen(s));
     tmp[0] = ' ';
     memcpy(tmp + 1, s, noffs);
-    tmp[(scs = cs = 1 + noffs)] = 'x';
+    tmp[(scs = zlecs = 1 + noffs)] = 'x';
     strcpy(tmp + 2 + noffs, s + noffs);
 
     switch (*compqstack) {
@@ -1318,8 +1318,8 @@ set_comp_sep(void)
             if (*p == '\\' && p[1] == '\\') {
                 dq++;
                 chuck(p);
-                if (j > cs) {
-                    cs++;
+                if (j > zlecs) {
+                    zlecs++;
                     css++;
                 }
                 if (!*p)
@@ -1329,8 +1329,8 @@ set_comp_sep(void)
     odq = dq;
     osq = sq;
     inpush(dupstrspace(tmp), 0, NULL);
-    line = (unsigned char *) tmp;
-    ll = tl - 1;
+    zleline = (unsigned char *) tmp;
+    zlell = tl - 1;
     strinbeg(0);
     noaliases = 1;
     do {
@@ -1383,7 +1383,7 @@ set_comp_sep(void)
 	    swb = wb - 1 - dq - sq;
 	    swe = we - 1 - dq - sq;
             sqq = lsq;
-	    soffs = cs - swb - css;
+	    soffs = zlecs - swb - css;
 	    chuck(p + soffs);
 	    ns = dupstring(p);
 	}
@@ -1397,9 +1397,9 @@ set_comp_sep(void)
     lexrestore();
     wb = owb;
     we = owe;
-    cs = ocs;
-    line = (unsigned char *) ol;
-    ll = oll;
+    zlecs = ocs;
+    zleline = (unsigned char *) ol;
+    zlell = oll;
     if (cur < 0 || i < 1)
 	return 1;
     owb = offs;
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index a71921a04..4b33a2921 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -200,14 +200,14 @@ compctlread(char *name, char **args, Options ops, char *reply)
 
     if (OPT_ISSET(ops,'l')) {
 	/* -ln gives the index of the word the cursor is currently on, which is
-	available in cs (but remember that Zsh counts from one, not zero!) */
+	available in zlecs (but remember that Zsh counts from one, not zero!) */
 	if (OPT_ISSET(ops,'n')) {
 	    char nbuf[14];
 
 	    if (OPT_ISSET(ops,'e') || OPT_ISSET(ops,'E'))
-		printf("%d\n", cs + 1);
+		printf("%d\n", zlecs + 1);
 	    if (!OPT_ISSET(ops,'e')) {
-		sprintf(nbuf, "%d", cs + 1);
+		sprintf(nbuf, "%d", zlecs + 1);
 		setsparam(reply, ztrdup(nbuf));
 	    }
 	    return 0;
@@ -215,11 +215,11 @@ compctlread(char *name, char **args, Options ops, char *reply)
 	/* without -n, the current line is assigned to the given parameter as a
 	scalar */
 	if (OPT_ISSET(ops,'e') || OPT_ISSET(ops,'E')) {
-	    zputs((char *) line, stdout);
+	    zputs((char *) zleline, stdout);
 	    putchar('\n');
 	}
 	if (!OPT_ISSET(ops,'e'))
-	    setsparam(reply, ztrdup((char *) line));
+	    setsparam(reply, ztrdup((char *) zleline));
     } else {
 	int i;
 
@@ -2560,7 +2560,7 @@ makecomplistor(Compctl cc, char *s, int incmd, int compadd, int sub)
 static void
 makecomplistlist(Compctl cc, char *s, int incmd, int compadd)
 {
-    int oloffs = offs, owe = we, owb = wb, ocs = cs;
+    int oloffs = offs, owe = we, owb = wb, ocs = zlecs;
 
     if (cc->ext)
 	/* Handle extended completion. */
@@ -2574,7 +2574,7 @@ makecomplistlist(Compctl cc, char *s, int incmd, int compadd)
     offs = oloffs;
     wb = owb;
     we = owe;
-    cs = ocs;
+    zlecs = ocs;
 }
 
 /* This add matches for extended completion patterns */
@@ -2751,10 +2751,10 @@ sep_comp_string(char *ss, char *s, int noffs)
 {
     LinkList foo = newlinklist();
     LinkNode n;
-    int owe = we, owb = wb, ocs = cs, swb, swe, scs, soffs, ne = noerrs;
-    int sl = strlen(ss), tl, got = 0, i = 0, cur = -1, oll = ll, remq;
+    int owe = we, owb = wb, ocs = zlecs, swb, swe, scs, soffs, ne = noerrs;
+    int sl = strlen(ss), tl, got = 0, i = 0, cur = -1, oll = zlell, remq;
     int ois = instring, oib = inbackt, ona = noaliases;
-    char *tmp, *p, *ns, *ol = (char *) line, sav, *oaq = autoq, *qp, *qs;
+    char *tmp, *p, *ns, *ol = (char *) zleline, sav, *oaq = autoq, *qp, *qs;
     char *ts, qc = '\0';
 
     swb = swe = soffs = 0;
@@ -2770,13 +2770,13 @@ sep_comp_string(char *ss, char *s, int noffs)
     strcpy(tmp, ss);
     tmp[sl] = ' ';
     memcpy(tmp + sl + 1, s, noffs);
-    tmp[(scs = cs = sl + 1 + noffs)] = 'x';
+    tmp[(scs = zlecs = sl + 1 + noffs)] = 'x';
     strcpy(tmp + sl + 2 + noffs, s + noffs);
     if ((remq = (*compqstack == '\\')))
 	tmp = rembslash(tmp);
     inpush(dupstrspace(tmp), 0, NULL);
-    line = (unsigned char *) tmp;
-    ll = tl - 1;
+    zleline = (unsigned char *) tmp;
+    zlell = tl - 1;
     strinbeg(0);
     noaliases = 1;
     do {
@@ -2807,7 +2807,7 @@ sep_comp_string(char *ss, char *s, int noffs)
 	    cur = i;
 	    swb = wb - 1;
 	    swe = we - 1;
-	    soffs = cs - swb;
+	    soffs = zlecs - swb;
 	    chuck(p + soffs);
 	    ns = dupstring(p);
 	}
@@ -2821,9 +2821,9 @@ sep_comp_string(char *ss, char *s, int noffs)
     lexrestore();
     wb = owb;
     we = owe;
-    cs = ocs;
-    line = (unsigned char *) ol;
-    ll = oll;
+    zlecs = ocs;
+    zleline = (unsigned char *) ol;
+    zlell = oll;
     if (cur < 0 || i < 1)
 	return 1;
     owb = offs;
@@ -2979,8 +2979,8 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	addlinknode(allccs, cc);
     }
     /* Go to the end of the word if complete_in_word is not set. */
-    if (unset(COMPLETEINWORD) && cs != we)
-	cs = we, offs = strlen(s);
+    if (unset(COMPLETEINWORD) && zlecs != we)
+	zlecs = we, offs = strlen(s);
 
     s = dupstring(s);
     delit = ispattern = 0;
@@ -3200,15 +3200,15 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	    ppre = dupstrpfx(rpre, s1 - rpre + 1);
 	psuf = dupstring(s2);
 
-	if (cs != wb) {
-	    char save = line[cs];
+	if (zlecs != wb) {
+	    char save = zleline[zlecs];
 
-	    line[cs] = 0;
-	    lppre = dupstring((char *) line + wb +
+	    zleline[zlecs] = 0;
+	    lppre = dupstring((char *) zleline + wb +
 			      (qipre && *qipre ?
 			       (strlen(qipre) -
 				(*qipre == '\'' || *qipre == '\"')) : 0));
-	    line[cs] = save;
+	    zleline[zlecs] = save;
 	    if (brbeg) {
 		Brinfo bp;
 
@@ -3230,25 +3230,25 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	    lppre = NULL;
 	    lppl = 0;
 	}
-	if (cs != we) {
+	if (zlecs != we) {
 	    int end = we;
-	    char save = line[end];
+	    char save = zleline[end];
 
 	    if (qisuf && *qisuf) {
 		int ql = strlen(qisuf);
 
 		end -= ql - (qisuf[ql-1] == '\'' || qisuf[ql-1] == '"');
 	    }
-	    line[end] = 0;
-	    lpsuf = dupstring((char *) (line + cs));
-	    line[end] = save;
+	    zleline[end] = 0;
+	    lpsuf = dupstring((char *) (zleline + zlecs));
+	    zleline[end] = save;
 	    if (brend) {
 		Brinfo bp;
 		char *p;
 		int bl;
 
 		for (bp = brend; bp; bp = bp->next) {
-		    p = lpsuf + (we - cs) - bp->qpos - (bl = strlen(bp->str));
+		    p = lpsuf + (we - zlecs) - bp->qpos - (bl = strlen(bp->str));
 		    strcpy(p, p + bl);
 		}
 	    }
@@ -3262,7 +3262,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 
 	/* And get the file prefix. */
 	fpre = dupstring(((s1 == s || s1 == rpre || ic) &&
-			  (*s != '/' || cs == wb)) ? s1 : s1 + 1);
+			  (*s != '/' || zlecs == wb)) ? s1 : s1 + 1);
 	qfpre = quotename(fpre, NULL);
 	/* And the suffix. */
 	fsuf = dupstrpfx(rsuf, s2 - rsuf);
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 2b2378a43..1cc709817 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1772,27 +1772,27 @@ setmstatus(char *status, char *sline, int sll, int scs,
     int pl, sl, max;
 
     if (csp) {
-        *csp = cs;
-        *llp = ll;
+        *csp = zlecs;
+        *llp = zlell;
         *lenp = lastend - wb;
 
-        ret = dupstring((char *) line);
+        ret = dupstring((char *) zleline);
 
-        p = (char *) zhalloc(cs - wb + 1);
-        strncpy(p, (char *) line + wb, cs - wb);
-        p[cs - wb] = '\0';
-        if (lastend < cs)
+        p = (char *) zhalloc(zlecs - wb + 1);
+        strncpy(p, (char *) zleline + wb, zlecs - wb);
+        p[zlecs - wb] = '\0';
+        if (lastend < zlecs)
             s = "";
         else {
-            s = (char *) zhalloc(lastend - cs + 1);
-            strncpy(s, (char *) line + cs, lastend - cs);
-            s[lastend - cs] = '\0';
+            s = (char *) zhalloc(lastend - zlecs + 1);
+            strncpy(s, (char *) zleline + zlecs, lastend - zlecs);
+            s[lastend - zlecs] = '\0';
         }
-        cs = 0;
-        foredel(ll);
+        zlecs = 0;
+        foredel(zlell);
         spaceinline(sll);
-        memcpy(line, sline, sll);
-        cs = scs;
+        memcpy(zleline, sline, sll);
+        zlecs = scs;
     } else {
         p = complastprefix;
         s = complastsuffix;
@@ -1994,11 +1994,11 @@ domenuselect(Hookdef dummy, Chdata dat)
 	     * was before completion started.
 	     */
             mode = MM_INTER;
-            cs = 0;
-            foredel(ll);
+            zlecs = 0;
+            foredel(zlell);
             spaceinline(l);
-            strncpy((char *) line, origline, l);
-            cs = origcs;
+            strncpy((char *) zleline, origline, l);
+            zlecs = origcs;
             setmstatus(status, NULL, 0 , 0, NULL, NULL, NULL);
         } else if (strpfx("search", s)) {
             mode = (strstr(s, "back") ? MM_BSEARCH : MM_FSEARCH);
@@ -2092,9 +2092,9 @@ domenuselect(Hookdef dummy, Chdata dat)
 	     * completion we don't want that, we always want to
 	     * be able to type the next character.
 	     */
-	    modeline = dupstring(line);
-            modecs = cs;
-            modell = ll;
+	    modeline = dupstring(zleline);
+            modecs = zlecs;
+            modell = zlell;
             modelen = minfo.len;
         }
         first = 0;
@@ -2188,11 +2188,11 @@ domenuselect(Hookdef dummy, Chdata dat)
 		 * start.
 		 */
                 mode = MM_INTER;
-                cs = 0;
-                foredel(ll);
+                zlecs = 0;
+                foredel(zlell);
                 spaceinline(l);
-                strncpy((char *) line, origline, l);
-                cs = origcs;
+                strncpy((char *) zleline, origline, l);
+                zlecs = origcs;
                 setmstatus(status, NULL, 0, 0, NULL, NULL, NULL);
 
                 continue;
@@ -2207,8 +2207,8 @@ domenuselect(Hookdef dummy, Chdata dat)
 
 	    s->prev = u;
 	    u = s;
-	    s->line = dupstring((char *) line);
-	    s->cs = cs;
+	    s->line = dupstring((char *) zleline);
+	    s->cs = zlecs;
 	    s->mline = mline;
 	    s->mlbeg = mlbeg;
 	    memcpy(&(s->info), &minfo, sizeof(struct menuinfo));
@@ -2247,21 +2247,21 @@ domenuselect(Hookdef dummy, Chdata dat)
 		 * the command line as it is with just the
 		 * characters typed by the user.
 		 */
-                cs = 0;
-                foredel(ll);
+                zlecs = 0;
+                foredel(zlell);
                 spaceinline(l);
-                strncpy((char *) line, origline, l);
-                cs = origcs;
+                strncpy((char *) zleline, origline, l);
+                zlecs = origcs;
 
                 if (cmd == Th(z_selfinsert))
                     selfinsert(zlenoargs);
                 else
                     selfinsertunmeta(zlenoargs);
 
-                saveline = (char *) zhalloc(ll);
-                memcpy(saveline, line, ll);
-                savell = ll;
-                savecs = cs;
+                saveline = (char *) zhalloc(zlell);
+                memcpy(saveline, zleline, zlell);
+                savell = zlell;
+                savecs = zlecs;
                 iforcemenu = -1;
             } else
                 mode = 0;
@@ -2313,8 +2313,8 @@ domenuselect(Hookdef dummy, Chdata dat)
             mode = 0;
 	    s->prev = u;
 	    u = s;
-	    s->line = dupstring((char *) line);
-	    s->cs = cs;
+	    s->line = dupstring((char *) zleline);
+	    s->cs = zlecs;
 	    s->mline = mline;
 	    s->mlbeg = mlbeg;
 	    memcpy(&(s->info), &minfo, sizeof(struct menuinfo));
@@ -2368,11 +2368,11 @@ domenuselect(Hookdef dummy, Chdata dat)
 		break;
 
 	    handleundo();
-	    cs = 0;
-	    foredel(ll);
+	    zlecs = 0;
+	    foredel(zlell);
 	    spaceinline(l = strlen(u->line));
-	    strncpy((char *) line, u->line, l);
-	    cs = u->cs;
+	    strncpy((char *) zleline, u->line, l);
+	    zlecs = u->cs;
 	    menuacc = u->acc;
 	    memcpy(&minfo, &(u->info), sizeof(struct menuinfo));
 	    p = &(minfo.cur);
@@ -2750,11 +2750,11 @@ domenuselect(Hookdef dummy, Chdata dat)
                 origline = modeline;
                 origcs = modecs;
                 origll = modell;
-                cs = 0;
-                foredel(ll);
+                zlecs = 0;
+                foredel(zlell);
                 spaceinline(origll);
-                strncpy((char *) line, origline, origll);
-                cs = origcs;
+                strncpy((char *) zleline, origline, origll);
+                zlecs = origcs;
                 minfo.len = modelen;
             } else {
                 mode = 0;
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 05b5f1a10..c0a881b45 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -169,7 +169,7 @@ static char *
 cline_str(Cline l, int ins, int *csp, LinkList posl)
 {
     Cline s;
-    int ocs = cs, ncs, pcs, scs, opos = -1, npos;
+    int ocs = zlecs, ncs, pcs, scs, opos = -1, npos;
     int pm, pmax, pmm, pma, sm, smax, smm, sma, d, dm, mid;
     int i, j, li = 0, cbr, padd = (ins ? wb - ocs : -ocs);
     Brinfo brp, brs;
@@ -205,7 +205,7 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 	}
 	while (brs && !brs->curpos) {
 	    if (cbr < 0)
-		cbr = cs;
+		cbr = zlecs;
 	    inststrlen(brs->str, 1, -1);
 	    brs = brs->prev;
 	}
@@ -214,21 +214,21 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
     while (l) {
 	/* Insert the original string if no prefix. */
 	if (l->olen && !(l->flags & CLF_SUF) && !l->prefix) {
-	    pcs = cs + l->olen;
+	    pcs = zlecs + l->olen;
 	    inststrlen(l->orig, 1, l->olen);
 	} else {
 	    /* Otherwise insert the prefix. */
 	    for (s = l->prefix; s; s = s->next) {
-		pcs = cs + s->llen;
+		pcs = zlecs + s->llen;
 		if (s->flags & CLF_LINE)
 		    inststrlen(s->line, 1, s->llen);
 		else
 		    inststrlen(s->word, 1, s->wlen);
-		scs = cs;
+		scs = zlecs;
 
 		if ((s->flags & CLF_DIFF) && (!dm || (s->flags & CLF_MATCHED))) {
-		    d = cs; dm = s->flags & CLF_MATCHED;
-		    if (posl && (npos = cs + padd) != opos) {
+		    d = zlecs; dm = s->flags & CLF_MATCHED;
+		    if (posl && (npos = zlecs + padd) != opos) {
 			opos = npos;
 			addlinknode(posl, (void *) ((long) npos));
 		    }
@@ -240,11 +240,11 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 	    int ocs, bl;
 
 	    while (brp && li >= brp->curpos) {
-		ocs = cs;
+		ocs = zlecs;
 		bl = strlen(brp->str);
-		cs = pcs - (li - brp->curpos);
+		zlecs = pcs - (li - brp->curpos);
 		inststrlen(brp->str, 1, bl);
-		cs = ocs + bl;
+		zlecs = ocs + bl;
 		pcs += bl;
 		scs += bl;
 		brp = brp->next;
@@ -253,14 +253,14 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 	/* Remember the position if this is the first prefix with
 	 * missing characters. */
 	if ((l->flags & CLF_MISS) && !(l->flags & CLF_SUF)) {
-	    if (posl && (npos = cs + padd) != opos) {
+	    if (posl && (npos = zlecs + padd) != opos) {
 		opos = npos;
 		addlinknode(posl, (void *) ((long) npos));
 	    }
 	    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;
+		pm = zlecs; pmax = l->max - l->min; pmm = l->flags & CLF_MATCHED;
 		pma = ((l->prefix || l->suffix) && l->min == cline_sublen(l));
 	    }
 	}
@@ -268,35 +268,35 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 	    int ocs, bl;
 
 	    while (brs && li >= brs->curpos) {
-		ocs = cs;
+		ocs = zlecs;
 		bl = strlen(brs->str);
-		cs = scs - (li - brs->curpos);
+		zlecs = scs - (li - brs->curpos);
 		if (cbr < 0)
-		    cbr = cs;
+		    cbr = zlecs;
 		inststrlen(brs->str, 1, bl);
-		cs = ocs + bl;
+		zlecs = ocs + bl;
 		pcs += bl;
 		brs = brs->prev;
 	    }
 	}
-	pcs = cs;
+	pcs = zlecs;
 	/* Insert the anchor. */
 	if (l->flags & CLF_LINE)
 	    inststrlen(l->line, 1, l->llen);
 	else
 	    inststrlen(l->word, 1, l->wlen);
-	scs = cs;
+	scs = zlecs;
 	if (ins) {
 	    int ocs, bl;
 
 	    li += l->llen;
 
 	    while (brp && li >= brp->curpos) {
-		ocs = cs;
+		ocs = zlecs;
 		bl = strlen(brp->str);
-		cs = pcs + l->llen - (li - brp->curpos);
+		zlecs = pcs + l->llen - (li - brp->curpos);
 		inststrlen(brp->str, 1, bl);
-		cs = ocs + bl;
+		zlecs = ocs + bl;
 		pcs += bl;
 		scs += bl;
 		brp = brp->next;
@@ -305,16 +305,16 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 	/* Remember the cursor position for suffixes and mids. */
 	if (l->flags & CLF_MISS) {
 	    if (l->flags & CLF_MID)
-		mid = cs;
+		mid = zlecs;
 	    else if (l->flags & CLF_SUF) {
-		if (posl && (npos = cs + padd) != opos) {
+		if (posl && (npos = zlecs + padd) != opos) {
 		    opos = npos;
 		    addlinknode(posl, (void *) ((long) npos));
 		}
 		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;
+		    sm = zlecs; smax = l->min - l->max; smm = l->flags & CLF_MATCHED;
 		    sma = ((l->prefix || l->suffix) && l->min == cline_sublen(l));
 		}
 	    }
@@ -323,20 +323,20 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 	    int ocs, bl;
 
 	    while (brs && li >= brs->curpos) {
-		ocs = cs;
+		ocs = zlecs;
 		bl = strlen(brs->str);
-		cs = scs - (li - brs->curpos);
+		zlecs = scs - (li - brs->curpos);
 		if (cbr < 0)
-		    cbr = cs;
+		    cbr = zlecs;
 		inststrlen(brs->str, 1, bl);
-		cs = ocs + bl;
+		zlecs = ocs + bl;
 		pcs += bl;
 		brs = brs->prev;
 	    }
 	}
 	/* And now insert the suffix or the original string. */
 	if (l->olen && (l->flags & CLF_SUF) && !l->suffix) {
-	    pcs = cs;
+	    pcs = zlecs;
 	    inststrlen(l->orig, 1, l->olen);
 	    if (ins) {
 		int ocs, bl;
@@ -344,22 +344,22 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 		li += l->olen;
 
 		while (brp && li >= brp->curpos) {
-		    ocs = cs;
+		    ocs = zlecs;
 		    bl = strlen(brp->str);
-		    cs = pcs + l->olen - (li - brp->curpos);
+		    zlecs = pcs + l->olen - (li - brp->curpos);
 		    inststrlen(brp->str, 1, bl);
-		    cs = ocs + bl;
+		    zlecs = ocs + bl;
 		    pcs += bl;
 		    brp = brp->next;
 		}
 		while (brs && li >= brs->curpos) {
-		    ocs = cs;
+		    ocs = zlecs;
 		    bl = strlen(brs->str);
-		    cs = pcs + l->olen - (li - brs->curpos);
+		    zlecs = pcs + l->olen - (li - brs->curpos);
 		    if (cbr < 0)
-			cbr = cs;
+			cbr = zlecs;
 		    inststrlen(brs->str, 1, bl);
-		    cs = ocs + bl;
+		    zlecs = ocs + bl;
 		    pcs += bl;
 		    brs = brs->prev;
 		}
@@ -370,13 +370,13 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 	    for (j = -1, i = 0, s = l->suffix; s; s = s->next) {
 		if (j < 0 && (s->flags & CLF_DIFF))
 		    j = i, js = s;
-		pcs = cs;
+		pcs = zlecs;
 		if (s->flags & CLF_LINE) {
 		    inststrlen(s->line, 0, s->llen);
-		    i += s->llen; scs = cs + s->llen;
+		    i += s->llen; scs = zlecs + s->llen;
 		} else {
 		    inststrlen(s->word, 0, s->wlen);
-		    i += s->wlen; scs = cs + s->wlen;
+		    i += s->wlen; scs = zlecs + s->wlen;
 		}
 		if (ins) {
 		    int ocs, bl;
@@ -384,32 +384,32 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 		    li += s->llen;
 
 		    while (brp && li >= brp->curpos) {
-			ocs = cs;
+			ocs = zlecs;
 			bl = strlen(brp->str);
-			cs = pcs + (li - brp->curpos);
+			zlecs = pcs + (li - brp->curpos);
 			inststrlen(brp->str, 1, bl);
-			cs = ocs + bl;
+			zlecs = ocs + bl;
 			pcs += bl;
 			scs += bl;
 			brp = brp->next;
 		    }
 		    while (brs && li >= brs->curpos) {
-			ocs = cs;
+			ocs = zlecs;
 			bl = strlen(brs->str);
-			cs = scs - (li - brs->curpos);
+			zlecs = scs - (li - brs->curpos);
 			if (cbr < 0)
-			    cbr = cs;
+			    cbr = zlecs;
 			inststrlen(brs->str, 1, bl);
-			cs = ocs + bl;
+			zlecs = ocs + bl;
 			pcs += bl;
 			brs = brs->prev;
 		    }
 		}
 	    }
-	    cs += i;
+	    zlecs += i;
 	    if (j >= 0 && (!dm || (js->flags & CLF_MATCHED))) {
-		d = cs - j; dm = js->flags & CLF_MATCHED;
-		if (posl && (npos = cs - j + padd) != opos) {
+		d = zlecs - j; dm = js->flags & CLF_MATCHED;
+		if (posl && (npos = zlecs - j + padd) != opos) {
 		    opos = npos;
 		    addlinknode(posl, (void *) ((long) npos));
 		}
@@ -417,7 +417,7 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 	}
 	l = l->next;
     }
-    if (posl && (npos = cs + padd) != opos)
+    if (posl && (npos = zlecs + padd) != opos)
 #if 0
 	/* This could be used to put an extra colon before the end-of-word
 	 * position if there is nothing missing. */
@@ -426,23 +426,23 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 	addlinknode(posl, (void *) ((long) npos));
 
     if (ins) {
-	int ocs = cs;
+	int ocs = zlecs;
 
 	for (; brp; brp = brp->next)
 	    inststrlen(brp->str, 1, -1);
 	for (; brs; brs = brs->prev) {
 	    if (cbr < 0)
-		cbr = cs;
+		cbr = zlecs;
 	    inststrlen(brs->str, 1, -1);
 	}
 	if (mid >= ocs)
-	    mid += cs - ocs;
+	    mid += zlecs - ocs;
 	if (pm >= ocs)
-	    pm += cs - ocs;
+	    pm += zlecs - ocs;
 	if (sm >= ocs)
-	    sm += cs - ocs;
+	    sm += zlecs - ocs;
 	if (d >= ocs)
-	    d += cs - ocs;
+	    d += zlecs - ocs;
 
 	if (posl) {
 	    LinkNode node;
@@ -451,7 +451,7 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 	    for (node = firstnode(posl); node; incnode(node)) {
 		p = (long) getdata(node);
 		if (p >= ocs)
-		    setdata(node, (void *) (p + cs - ocs));
+		    setdata(node, (void *) (p + zlecs - ocs));
 	    }
 	}
     }
@@ -461,16 +461,16 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
      * suffix, and finally a place where the matches differ. */
     ncs = (mid >= 0 ? mid :
 	   (cbr >= 0 ? cbr :
-	    (pm >= 0 ? pm : (sm >= 0 ? sm : (d >= 0 ? d : cs)))));
+	    (pm >= 0 ? pm : (sm >= 0 ? sm : (d >= 0 ? d : zlecs)))));
 
     if (ins != 1) {
 	/* We always inserted the string in the line. If that was not
 	 * requested, we copy it and remove from the line. */
-	char *r = zalloc((i = cs - ocs) + 1);
+	char *r = zalloc((i = zlecs - ocs) + 1);
 
-	memcpy(r, (char *) (line + ocs), i);
+	memcpy(r, (char *) (zleline + ocs), i);
 	r[i] = '\0';
-	cs = ocs;
+	zlecs = ocs;
 	foredel(i);
 
 	if (csp)
@@ -478,8 +478,8 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
 
 	return r;
     }
-    lastend = cs;
-    cs = ncs;
+    lastend = zlecs;
+    zlecs = ncs;
 
     return NULL;
 }
@@ -579,7 +579,7 @@ unambig_data(int *cp, char **pp, char **ip)
 static int
 instmatch(Cmatch m, int *scs)
 {
-    int l, r = 0, ocs, a = cs, brb = 0, bradd, *brpos;
+    int l, r = 0, ocs, a = zlecs, brb = 0, bradd, *brpos;
     Brinfo bp;
 
     zsfree(lastprebr);
@@ -606,28 +606,28 @@ instmatch(Cmatch m, int *scs)
     /* The string itself. */
     inststrlen(m->str, 1, (l = strlen(m->str)));
     r += l;
-    ocs = cs;
+    ocs = zlecs;
     /* Re-insert the brace beginnings, if any. */
     if (brbeg) {
-	int pcs = cs;
+	int pcs = zlecs;
 
 	l = 0;
 	for (bp = brbeg, brpos = m->brpl,
 		 bradd = (m->pre ? strlen(m->pre) : 0);
 	     bp; bp = bp->next, brpos++) {
-	    cs = a + *brpos + bradd;
-	    pcs = cs;
+	    zlecs = a + *brpos + bradd;
+	    pcs = zlecs;
 	    l = strlen(bp->str);
 	    bradd += l;
-	    brpcs = cs;
+	    brpcs = zlecs;
 	    inststrlen(bp->str, 1, l);
 	    r += l;
 	    ocs += l;
 	}
 	lastprebr = (char *) zalloc(pcs - a + 1);
-	memcpy(lastprebr, (char *) line + a, pcs - a);
+	memcpy(lastprebr, (char *) zleline + a, pcs - a);
 	lastprebr[pcs - a] = '\0';
-	cs = ocs;
+	zlecs = ocs;
     }
     /* Path suffix. */
     if (m->psuf) {
@@ -636,24 +636,24 @@ instmatch(Cmatch m, int *scs)
     }
     /* Re-insert the brace end. */
     if (brend) {
-	a = cs;
+	a = zlecs;
 	for (bp = brend, brpos = m->brsl, bradd = 0; bp; bp = bp->next, brpos++) {
-	    cs = a - *brpos;
-	    ocs = brscs = cs;
+	    zlecs = a - *brpos;
+	    ocs = brscs = zlecs;
 	    l = strlen(bp->str);
 	    bradd += l;
 	    inststrlen(bp->str, 1, l);
-	    brb = cs;
+	    brb = zlecs;
 	    r += l;
 	}
-	cs = a + bradd;
+	zlecs = a + bradd;
 	if (scs)
 	    *scs = ocs;
     } else {
 	brscs = -1;
 
 	if (scs)
-	    *scs = cs;
+	    *scs = zlecs;
     }
     /* -S suffix */
     if (m->suf) {
@@ -666,12 +666,12 @@ instmatch(Cmatch m, int *scs)
 	r += l;
     }
     if (brend) {
-	lastpostbr = (char *) zalloc(cs - brb + 1);
-	memcpy(lastpostbr, (char *) line + brb, cs - brb);
-	lastpostbr[cs - brb] = '\0';
+	lastpostbr = (char *) zalloc(zlecs - brb + 1);
+	memcpy(lastpostbr, (char *) zleline + brb, zlecs - brb);
+	lastpostbr[zlecs - brb] = '\0';
     }
-    lastend = cs;
-    cs = ocs;
+    lastend = zlecs;
+    zlecs = ocs;
 
     return r;
 }
@@ -687,20 +687,20 @@ hasbrpsfx(Cmatch m, char *pre, char *suf)
 	return 1;
     else {
 	char *op = lastprebr, *os = lastpostbr;
-	VARARR(char, oline, ll);
-	int oll = ll, ocs = cs, ole = lastend, opcs = brpcs, oscs = brscs, ret;
+	VARARR(char, oline, zlell);
+	int oll = zlell, ocs = zlecs, ole = lastend, opcs = brpcs, oscs = brscs, ret;
 
-	memcpy(oline, line, ll);
+	memcpy(oline, zleline, zlell);
 
 	lastprebr = lastpostbr = NULL;
 
 	instmatch(m, NULL);
 
-	cs = 0;
-	foredel(ll);
+	zlecs = 0;
+	foredel(zlell);
 	spaceinline(oll);
-	memcpy(line, oline, oll);
-	cs = ocs;
+	memcpy(zleline, oline, oll);
+	zlecs = ocs;
 	lastend = ole;
 	brpcs = opcs;
 	brscs = oscs;
@@ -754,7 +754,7 @@ do_ambiguous(void)
 	 * completion options.                                             */
 	do_ambig_menu();
     } else if (ainfo) {
-	int atend = (cs == we), la, eq, tcs;
+	int atend = (zlecs == we), la, eq, tcs;
 	VARARR(char, old, we - wb);
 
 	minfo.cur = NULL;
@@ -763,9 +763,9 @@ do_ambiguous(void)
 	fixsuffix();
 
 	/* First remove the old string from the line. */
-	tcs = cs;
-	cs = wb;
-	memcpy(old, (char *) line + wb, we - wb);
+	tcs = zlecs;
+	zlecs = wb;
+	memcpy(old, (char *) zleline + wb, we - wb);
 	foredel(we - wb);
 
 	/* Now get the unambiguous string and insert it into the line. */
@@ -776,23 +776,23 @@ do_ambiguous(void)
          * old string. Unless there were matches added with -U, that is. */
 
 	if (lastend < we && !lenchanged && !hasunmatched) {
-	    cs = wb;
+	    zlecs = wb;
 	    foredel(lastend - wb);
 	    inststrlen(old, 0, we - wb);
 	    lastend = we;
-	    cs = tcs;
+	    zlecs = tcs;
 	}
 	if (eparq) {
-	    tcs = cs;
-	    cs = lastend;
+	    tcs = zlecs;
+	    zlecs = lastend;
 	    for (eq = eparq; eq; eq--)
 		inststrlen("\"", 0, 1);
-	    cs = tcs;
+	    zlecs = tcs;
 	}
 	/* la is non-zero if listambiguous may be used. Copying and
 	 * comparing the line looks like BFI but it is the easiest
 	 * solution. Really. */
-	la = (ll != origll || strncmp(origline, (char *) line, ll));
+	la = (zlell != origll || strncmp(origline, (char *) zleline, zlell));
 
 	/* If REC_EXACT and AUTO_MENU are set and what we inserted is an  *
 	 * exact match, we want menu completion the next time round       *
@@ -800,11 +800,11 @@ do_ambiguous(void)
 	 * taken as an exact match. Also we remember if we just moved the *
 	 * cursor into the word.                                          */
 	fromcomp = ((isset(AUTOMENU) ? FC_LINE : 0) |
-		    ((atend && cs != lastend) ? FC_INWORD : 0));
+		    ((atend && zlecs != lastend) ? FC_INWORD : 0));
 
 	/* Probably move the cursor to the end. */
 	if (movetoend == 3)
-	    cs = lastend;
+	    zlecs = lastend;
 
 	/* If the LIST_AMBIGUOUS option (meaning roughly `show a list only *
 	 * if the completion is completely ambiguous') is set, and some    *
@@ -947,7 +947,7 @@ do_single(Cmatch m)
 	 * so set the position variables.             */
 	minfo.pos = wb;
 	minfo.we = (movetoend >= 2 || (movetoend == 1 && !menucmp) ||
-		    (!movetoend && cs == we));
+		    (!movetoend && zlecs == we));
 	minfo.end = we;
     }
     /* If we are already in a menu-completion or if we have done a *
@@ -959,7 +959,7 @@ do_single(Cmatch m)
 	l = we - wb;
 
     minfo.insc = 0;
-    cs = minfo.pos;
+    zlecs = minfo.pos;
     foredel(l);
 
     if (m->flags & CMF_ALL) {
@@ -969,8 +969,8 @@ do_single(Cmatch m)
 
     /* And then we insert the new string. */
     minfo.len = instmatch(m, &scs);
-    minfo.end = cs;
-    cs = minfo.pos + minfo.len;
+    minfo.end = zlecs;
+    zlecs = minfo.pos + minfo.len;
 
     if (m->suf) {
 	havesuff = 1;
@@ -987,13 +987,13 @@ do_single(Cmatch m)
     } else {
 	/* There is no user-specified suffix, *
 	 * so generate one automagically.     */
-	cs = scs;
+	zlecs = scs;
 	if (partest && (m->flags & CMF_PARBR)) {
 	    int pq;
 
 	    /*{{*/
 	    /* Completing a parameter in braces.  Add a removable `}' suffix. */
-	    cs += eparq;
+	    zlecs += eparq;
 	    for (pq = parq; pq; pq--)
 		inststrlen("\"", 1, 1);
 	    minfo.insc += parq;
@@ -1005,7 +1005,7 @@ do_single(Cmatch m)
 		havesuff = 1;
 	}
 	if (((m->flags & CMF_FILE) || (partest && isset(AUTOPARAMSLASH))) &&
-	    cs > 0 && line[cs - 1] != '/') {
+	    zlecs > 0 && zleline[zlecs - 1] != '/') {
 	    /* If we have a filename or we completed a parameter name      *
 	     * and AUTO_PARAM_SLASH is set, lets see if it is a directory. *
 	     * If it is, we append a slash.                                */
@@ -1079,7 +1079,7 @@ do_single(Cmatch m)
 	    }
 	}
 	if (!minfo.insc)
-	    cs = minfo.pos + minfo.len - m->qisl;
+	    zlecs = minfo.pos + minfo.len - m->qisl;
     }
     /* If completing in a brace expansion... */
     if (brbeg) {
@@ -1092,7 +1092,7 @@ do_single(Cmatch m)
 	} else if (!menucmp) {
 	    /*{{*/
 	    /* Otherwise, add a `,' suffix, and let `}' remove it. */
-	    cs = scs;
+	    zlecs = scs;
 	    havesuff = 1;
 	    inststrlen(",", 1, 1);
 	    minfo.insc++;
@@ -1121,9 +1121,9 @@ do_single(Cmatch m)
 	makeparamsuffix(((m->flags & CMF_PARBR) ? 1 : 0), minfo.insc - parq);
 
     if ((menucmp && !minfo.we) || !movetoend) {
-	cs = minfo.end;
-	if (cs + m->qisl == lastend)
-	    cs += minfo.insc;
+	zlecs = minfo.end;
+	if (zlecs + m->qisl == lastend)
+	    zlecs += minfo.insc;
     }
     {
 	Cmatch *om = minfo.cur;
@@ -1232,27 +1232,27 @@ accept_last(void)
 
 	iremovesuffix(',', 1);
 
-	l = (brscs >= 0 ? brscs : cs) - brpcs;
+	l = (brscs >= 0 ? brscs : zlecs) - brpcs;
 
 	zsfree(lastbrbeg->str);
 	lastbrbeg->str = (char *) zalloc(l + 2);
-	memcpy(lastbrbeg->str, line + brpcs, l);
+	memcpy(lastbrbeg->str, zleline + brpcs, l);
 	lastbrbeg->str[l] = ',';
 	lastbrbeg->str[l + 1] = '\0';
     } else {
 	int l;
 
-	cs = minfo.pos + minfo.len + minfo.insc;
+	zlecs = minfo.pos + minfo.len + minfo.insc;
 	iremovesuffix(' ', 1);
-	l = cs;
-	cs = minfo.pos + minfo.len + minfo.insc - (*(minfo.cur))->qisl;
-	if (cs < l)
-	    foredel(l - cs);
-	else if (cs > ll)
-	    cs = ll;
+	l = zlecs;
+	zlecs = minfo.pos + minfo.len + minfo.insc - (*(minfo.cur))->qisl;
+	if (zlecs < l)
+	    foredel(l - zlecs);
+	else if (zlecs > zlell)
+	    zlecs = zlell;
 	inststrlen(" ", 1, 1);
 	minfo.insc = minfo.len = 0;
-	minfo.pos = cs;
+	minfo.pos = zlecs;
 	minfo.we = 1;
     }
     return 0;
diff --git a/Src/Zle/deltochar.c b/Src/Zle/deltochar.c
index 054e7fe23..545c34c9f 100644
--- a/Src/Zle/deltochar.c
+++ b/Src/Zle/deltochar.c
@@ -37,18 +37,18 @@ static Widget w_zaptochar;
 static int
 deltochar(UNUSED(char **args))
 {
-    int c = getkey(0), dest = cs, ok = 0, n = zmult;
+    int c = getkey(0), dest = zlecs, ok = 0, n = zmult;
     int zap = (bindk->widget == w_zaptochar);
 
     if (n > 0) {
-	while (n-- && dest != ll) {
-	    while (dest != ll && line[dest] != c)
+	while (n-- && dest != zlell) {
+	    while (dest != zlell && zleline[dest] != c)
 		dest++;
-	    if (dest != ll) {
+	    if (dest != zlell) {
 		if (!zap || n > 0)
 		    dest++;
 		if (!n) {
-		    forekill(dest - cs, 0);
+		    forekill(dest - zlecs, 0);
 		    ok++;
 		}
 	    }
@@ -58,11 +58,11 @@ deltochar(UNUSED(char **args))
 	if (dest)
 	    dest--;
 	while (n++ && dest != 0) {
-	    while (dest != 0 && line[dest] != c)
+	    while (dest != 0 && zleline[dest] != c)
 		dest--;
-	    if (line[dest] == c) {
+	    if (zleline[dest] == c) {
 		if (!n) {
-		    backkill(cs - dest - zap, 1);
+		    backkill(zlecs - dest - zap, 1);
 		    ok++;
 		}
 		if (dest)
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index e636073c8..be6e2c80b 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -27,11 +27,6 @@
  *
  */
 
-#undef trashzle
-#undef zleread
-#undef spaceinline
-#undef zrefresh
-
 typedef struct widget *Widget;
 typedef struct thingy *Thingy;
 
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 97635b142..4733d5843 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -56,9 +56,9 @@ void
 remember_edits(void)
 {
     Histent ent = quietgethist(histline);
-    if (ent && metadiffer(ZLETEXT(ent), (char *) line, ll)) {
+    if (ent && metadiffer(ZLETEXT(ent), (char *) zleline, zlell)) {
 	zsfree(ent->zle_text);
-	ent->zle_text = metafy((char *) line, ll, META_DUP);
+	ent->zle_text = metafy((char *) zleline, zlell, META_DUP);
     }
 }
 
@@ -97,22 +97,22 @@ upline(void)
 	return n;
     }
     if (lastcol == -1)
-	lastcol = cs - findbol();
-    cs = findbol();
+	lastcol = zlecs - findbol();
+    zlecs = findbol();
     while (n) {
-	if (!cs)
+	if (!zlecs)
 	    break;
-	cs--;
-	cs = findbol();
+	zlecs--;
+	zlecs = findbol();
 	n--;
     }
     if (!n) {
 	int x = findeol();
 
-	if ((cs += lastcol) >= x) {
-	    cs = x;
-	    if (cs > findbol() && invicmdmode())
-		cs--;
+	if ((zlecs += lastcol) >= x) {
+	    zlecs = x;
+	    if (zlecs > findbol() && invicmdmode())
+		zlecs--;
 	}
     }
     return n;
@@ -122,12 +122,12 @@ upline(void)
 int
 uplineorhistory(char **args)
 {
-    int ocs = cs;
+    int ocs = zlecs;
     int n = upline();
     if (n) {
 	int m = zmult, ret;
 
-	cs = ocs;
+	zlecs = ocs;
 	if (virangeflag || !(zlereadflags & ZLRF_HISTORY))
 	    return 1;
 	zmult = n;
@@ -152,12 +152,12 @@ viuplineorhistory(char **args)
 int
 uplineorsearch(char **args)
 {
-    int ocs = cs;
+    int ocs = zlecs;
     int n = upline();
     if (n) {
 	int m = zmult, ret;
 
-	cs = ocs;
+	zlecs = ocs;
 	if (virangeflag || !(zlereadflags & ZLRF_HISTORY))
 	    return 1;
 	zmult = n;
@@ -181,22 +181,22 @@ downline(void)
 	return n;
     }
     if (lastcol == -1)
-	lastcol = cs - findbol();
+	lastcol = zlecs - findbol();
     while (n) {
 	int x = findeol();
 
-	if (x == ll)
+	if (x == zlell)
 	    break;
-	cs = x + 1;
+	zlecs = x + 1;
 	n--;
     }
     if (!n) {
 	int x = findeol();
 
-	if ((cs += lastcol) >= x) {
-	    cs = x;
-	    if (cs > findbol() && invicmdmode())
-		cs--;
+	if ((zlecs += lastcol) >= x) {
+	    zlecs = x;
+	    if (zlecs > findbol() && invicmdmode())
+		zlecs--;
 	}
     }
     return n;
@@ -206,12 +206,12 @@ downline(void)
 int
 downlineorhistory(char **args)
 {
-    int ocs = cs;
+    int ocs = zlecs;
     int n = downline();
     if (n) {
 	int m = zmult, ret;
 
-	cs = ocs;
+	zlecs = ocs;
 	if (virangeflag || !(zlereadflags & ZLRF_HISTORY))
 	    return 1;
 	zmult = n;
@@ -236,12 +236,12 @@ vidownlineorhistory(char **args)
 int
 downlineorsearch(char **args)
 {
-    int ocs = cs;
+    int ocs = zlecs;
     int n = downline();
     if (n) {
 	int m = zmult, ret;
 
-	cs = ocs;
+	zlecs = ocs;
 	if (virangeflag || !(zlereadflags & ZLRF_HISTORY))
 	    return 1;
 	zmult = n;
@@ -297,14 +297,14 @@ historysearchbackward(char **args)
     if ((str = *args))
 	hp = strlen(str);
     else {
-	if (histline == curhist || histline != srch_hl || cs != srch_cs ||
-	    mark != 0 || memcmp(srch_str, line, histpos) != 0) {
+	if (histline == curhist || histline != srch_hl || zlecs != srch_cs ||
+	    mark != 0 || memcmp(srch_str, zleline, histpos) != 0) {
 	    zfree(srch_str, histpos);
-	    for (histpos = 0; histpos < ll && !iblank(line[histpos]); histpos++) ;
-	    if (histpos < ll)
+	    for (histpos = 0; histpos < zlell && !iblank(zleline[histpos]); histpos++) ;
+	    if (histpos < zlell)
 		histpos++;
 	    srch_str = zalloc(histpos);
-	    memcpy(srch_str, line, histpos);
+	    memcpy(srch_str, zleline, histpos);
 	}
 	str = srch_str;
 	hp = histpos;
@@ -316,11 +316,11 @@ historysearchbackward(char **args)
 	    continue;
 	s = ZLETEXT(he);
 	if (metadiffer(s, str, hp) < 0 &&
-	    (*args || metadiffer(s, str, ll))) {
+	    (*args || metadiffer(s, str, zlell))) {
 	    if (--n <= 0) {
 		zle_setline(he);
 		srch_hl = histline;
-		srch_cs = cs;
+		srch_cs = zlecs;
 		return 0;
 	    }
 	}
@@ -346,14 +346,14 @@ historysearchforward(char **args)
     if ((str = *args))
 	hp = strlen(str);
     else {
-	if (histline == curhist || histline != srch_hl || cs != srch_cs ||
-	    mark != 0 || memcmp(srch_str, line, histpos) != 0) {
+	if (histline == curhist || histline != srch_hl || zlecs != srch_cs ||
+	    mark != 0 || memcmp(srch_str, zleline, histpos) != 0) {
 	    zfree(srch_str, histpos);
-	    for (histpos = 0; histpos < ll && !iblank(line[histpos]); histpos++) ;
-	    if (histpos < ll)
+	    for (histpos = 0; histpos < zlell && !iblank(zleline[histpos]); histpos++) ;
+	    if (histpos < zlell)
 		histpos++;
 	    srch_str = zalloc(histpos);
-	    memcpy(srch_str, line, histpos);
+	    memcpy(srch_str, zleline, histpos);
 	}
 	str = srch_str;
 	hp = histpos;
@@ -365,11 +365,11 @@ historysearchforward(char **args)
 	    continue;
 	s = ZLETEXT(he);
 	if (metadiffer(s, str, hp) < (he->histnum == curhist) &&
-	    (*args || metadiffer(s, str, ll))) {
+	    (*args || metadiffer(s, str, zlell))) {
 	    if (--n <= 0) {
 		zle_setline(he);
 		srch_hl = histline;
-		srch_cs = cs;
+		srch_cs = zlecs;
 		return 0;
 	    }
 	}
@@ -382,7 +382,7 @@ int
 beginningofbufferorhistory(char **args)
 {
     if (findbol())
-	cs = 0;
+	zlecs = 0;
     else
 	return beginningofhistory(args);
     return 0;
@@ -401,8 +401,8 @@ beginningofhistory(UNUSED(char **args))
 int
 endofbufferorhistory(char **args)
 {
-    if (findeol() != ll)
-	cs = ll;
+    if (findeol() != zlell)
+	zlecs = zlell;
     else
 	return endofhistory(args);
     return 0;
@@ -455,9 +455,9 @@ insertlastword(char **args)
     }
 
     if (lastinsert && lastlen &&
-	lastpos <= cs &&
-	lastlen == cs - lastpos &&
-	memcmp(lastinsert, (char *)&line[lastpos], lastlen) == 0)
+	lastpos <= zlecs &&
+	lastlen == zlecs - lastpos &&
+	memcmp(lastinsert, (char *)&zleline[lastpos], lastlen) == 0)
 	deleteword = 1;
     else
 	lasthist = curhist;
@@ -471,9 +471,9 @@ insertlastword(char **args)
 	 * confusion.
 	 */
 	if (deleteword) {
-	    int pos = cs;
-	    cs = lastpos;
-	    foredel(pos - cs);
+	    int pos = zlecs;
+	    zlecs = lastpos;
+	    foredel(pos - zlecs);
 	    /*
 	     * Mark that this has been deleted.
 	     * For consistency with history lines, we really ought to
@@ -527,9 +527,9 @@ insertlastword(char **args)
      * successfully found a new one to insert.
      */
     if (deleteword > 0) {
-	int pos = cs;
-	cs = lastpos;
-	foredel(pos - cs);
+	int pos = zlecs;
+	zlecs = lastpos;
+	foredel(pos - zlecs);
     }
     if (lastinsert) {
 	zfree(lastinsert, lastlen);
@@ -548,7 +548,7 @@ insertlastword(char **args)
     save = *t;
     *t = '\0';			/* ignore trailing whitespace */
     lasthist = evhist;
-    lastpos = cs;
+    lastpos = zlecs;
     lastlen = t - s;
     lastinsert = zalloc(t - s);
     memcpy(lastinsert, s, lastlen);
@@ -593,7 +593,7 @@ zle_goto_hist(int ev, int n, int skipdups)
 	return 1;
     if (skipdups && n) {
 	n = n < 0? -1 : 1;
-	while (he && !metadiffer(ZLETEXT(he), (char *) line, ll))
+	while (he && !metadiffer(ZLETEXT(he), (char *) zleline, zlell))
 	    he = movehistent(he, n, hist_skip_flags);
     }
     if (!he)
@@ -610,12 +610,12 @@ pushline(UNUSED(char **args))
 
     if (n < 0)
 	return 1;
-    zpushnode(bufstack, metafy((char *) line, ll, META_DUP));
+    zpushnode(bufstack, metafy((char *) zleline, zlell, META_DUP));
     while (--n)
 	zpushnode(bufstack, ztrdup(""));
-    stackcs = cs;
-    *line = '\0';
-    ll = cs = 0;
+    stackcs = zlecs;
+    *zleline = '\0';
+    zlell = zlecs = 0;
     clearlist = 1;
     return 0;
 }
@@ -632,12 +632,12 @@ pushlineoredit(char **args)
 	return 1;
     if (hline && *hline) {
 	ics = ztrlen(hline);
-	sizeline(ics + ll + 1);
-	for (s = line + ll; --s >= line; *(s + ics) = *s);
-	for (s = line; *hline; hline++)
+	sizeline(ics + zlell + 1);
+	for (s = zleline + zlell; --s >= zleline; *(s + ics) = *s);
+	for (s = zleline; *hline; hline++)
 	    *s++ = *hline == Meta ? *++hline ^ 32 : *hline;
-	ll += ics;
-	cs += ics;
+	zlell += ics;
+	zlecs += ics;
     }
     ret = pushline(args);
     if (!isfirstln)
@@ -674,8 +674,8 @@ zgetline(UNUSED(char **args))
 
 	unmetafy(s, &cc);
 	spaceinline(cc);
-	memcpy((char *)line + cs, s, cc);
-	cs += cc;
+	memcpy((char *)zleline + zlecs, s, cc);
+	zlecs += cc;
 	free(s);
 	clearlist = 1;
     }
@@ -789,12 +789,12 @@ doisearch(char **args, int dir)
     okeymap = ztrdup(curkeymapname);
     s = ZLETEXT(he);
     selectkeymap("main", 1);
-    pos = metalen(s, cs);
+    pos = metalen(s, zlecs);
     for (;;) {
 	/* Remember the current values in case search fails (doesn't push). */
-	set_isrch_spot(top_spot, hl, pos, cs, sbptr, dir, nomatch);
+	set_isrch_spot(top_spot, hl, pos, zlecs, sbptr, dir, nomatch);
 	if (sbptr == 1 && sbuf[0] == '^') {
-	    cs = 0;
+	    zlecs = 0;
     	    nomatch = 0;
 	    statusline = ibuf + NORM_PROMPT_POS;
 	} else if (sbptr > 0) {
@@ -823,7 +823,7 @@ doisearch(char **args, int dir)
 		    (t = hstrnstr(s, pos, sbuf, sbptr, dir, sens)))) {
 		    zle_setline(he);
 		    pos = t - s;
-		    cs = ztrsub(t, s) + (dir == 1? sbptr - (sbuf[0]=='^') : 0);
+		    zlecs = ztrsub(t, s) + (dir == 1? sbptr - (sbuf[0]=='^') : 0);
 	    	    nomatch = 0;
 		    statusline = ibuf + NORM_PROMPT_POS;
 		    break;
@@ -833,7 +833,7 @@ doisearch(char **args, int dir)
 		    if (sbptr == (int)isrch_spots[top_spot-1].len
 		     && (isrch_spots[top_spot-1].flags & ISS_FAILING))
 			top_spot--;
-		    get_isrch_spot(top_spot, &hl, &pos, &cs, &sbptr,
+		    get_isrch_spot(top_spot, &hl, &pos, &zlecs, &sbptr,
 				   &dir, &nomatch);
 		    if (!nomatch) {
 			feep = 1;
@@ -866,7 +866,7 @@ doisearch(char **args, int dir)
 	    he = quietgethist(hl);
 	    zle_setline(he);
 	    s = ZLETEXT(he);
-	    cs = i;
+	    zlecs = i;
 	    break;
 	}
 	if(cmd == Th(z_clearscreen)) {
@@ -882,7 +882,7 @@ doisearch(char **args, int dir)
 	} else if(cmd == Th(z_vibackwarddeletechar) ||
 	    	cmd == Th(z_backwarddeletechar)) {
 	    if (top_spot)
-		get_isrch_spot(--top_spot, &hl, &pos, &cs, &sbptr,
+		get_isrch_spot(--top_spot, &hl, &pos, &zlecs, &sbptr,
 			       &dir, &nomatch);
 	    else
 		feep = 1;
@@ -893,9 +893,9 @@ doisearch(char **args, int dir)
 	    he = quietgethist(hl);
 	    s = ZLETEXT(he);
 	    if (nomatch || !sbptr || (sbptr == 1 && sbuf[0] == '^')) {
-		int i = cs;
+		int i = zlecs;
 		zle_setline(he);
-		cs = i;
+		zlecs = i;
 	    }
 	    memcpy(ibuf + NORM_PROMPT_POS, (dir == 1) ? "fwd" : "bck", 3);
 	    continue;
@@ -912,26 +912,26 @@ doisearch(char **args, int dir)
 	    acceptline(zlenoargs);
 	    break;
 	} else if(cmd == Th(z_historyincrementalsearchbackward)) {
-	    set_isrch_spot(top_spot++, hl, pos, cs, sbptr, dir, nomatch);
+	    set_isrch_spot(top_spot++, hl, pos, zlecs, sbptr, dir, nomatch);
 	    if (dir != -1)
 		dir = -1;
 	    else
 		skip_pos = 1;
 	    goto rpt;
 	} else if(cmd == Th(z_historyincrementalsearchforward)) {
-	    set_isrch_spot(top_spot++, hl, pos, cs, sbptr, dir, nomatch);
+	    set_isrch_spot(top_spot++, hl, pos, zlecs, sbptr, dir, nomatch);
 	    if (dir != 1)
 		dir = 1;
 	    else
 		skip_pos = 1;
 	    goto rpt;
 	} else if(cmd == Th(z_virevrepeatsearch)) {
-	    set_isrch_spot(top_spot++, hl, pos, cs, sbptr, dir, nomatch);
+	    set_isrch_spot(top_spot++, hl, pos, zlecs, sbptr, dir, nomatch);
 	    dir = -odir;
 	    skip_pos = 1;
 	    goto rpt;
 	} else if(cmd == Th(z_virepeatsearch)) {
-	    set_isrch_spot(top_spot++, hl, pos, cs, sbptr, dir, nomatch);
+	    set_isrch_spot(top_spot++, hl, pos, zlecs, sbptr, dir, nomatch);
 	    dir = odir;
 	    skip_pos = 1;
 	rpt:
@@ -973,7 +973,7 @@ doisearch(char **args, int dir)
 		feep = 1;
 		continue;
 	    }
-	    set_isrch_spot(top_spot++, hl, pos, cs, sbptr, dir, nomatch);
+	    set_isrch_spot(top_spot++, hl, pos, zlecs, sbptr, dir, nomatch);
 	    if (sbptr == sibuf - FIRST_SEARCH_CHAR - 2) {
 		ibuf = hrealloc(ibuf, sibuf, sibuf * 2);
 		sbuf = ibuf + FIRST_SEARCH_CHAR;
@@ -1006,7 +1006,7 @@ infernexthist(Histent he, UNUSED(char **args))
 {
     for (he = movehistent(he, -2, HIST_FOREIGN);
 	 he; he = movehistent(he, -1, HIST_FOREIGN)) {
-	if (!metadiffer(he->text, (char *) line, ll))
+	if (!metadiffer(he->text, (char *) zleline, zlell))
 	    return movehistent(he, 1, HIST_FOREIGN);
     }
     return NULL;
@@ -1046,8 +1046,8 @@ vifetchhistory(UNUSED(char **args))
 	return 1;
     if (histline == curhist) {
 	if (!(zmod.flags & MOD_MULT)) {
-	    cs = ll;
-	    cs = findbol();
+	    zlecs = zlell;
+	    zlecs = findbol();
 	    return 0;
 	}
     }
@@ -1222,7 +1222,7 @@ virepeatsearch(UNUSED(char **args))
 	if (isset(HISTFINDNODUPS) && he->flags & HIST_DUP)
 	    continue;
 	s = ZLETEXT(he);
-	if (metadiffer(s, (char *) line, ll)
+	if (metadiffer(s, (char *) zleline, zlell)
 	 && (*visrchstr == '^'? strncmp(s, visrchstr + 1, t0 - 1) == 0
 			      : hstrnstr(s, 0, visrchstr, t0, 1, 1) != 0)) {
 	    if (--n <= 0) {
@@ -1246,7 +1246,7 @@ virevrepeatsearch(char **args)
 }
 
 /* Extra function added by A.R. Iano-Fletcher.	*/
-/*The extern variable "cs" is the position of the cursor. */
+/*The extern variable "zlecs" is the position of the cursor. */
 /* history-beginning-search-backward */
 
 /**/
@@ -1254,7 +1254,7 @@ int
 historybeginningsearchbackward(char **args)
 {
     Histent he;
-    int cpos = cs;		/* save cursor position */
+    int cpos = zlecs;		/* save cursor position */
     int n = zmult;
     char *s;
 
@@ -1271,11 +1271,11 @@ historybeginningsearchbackward(char **args)
 	if (isset(HISTFINDNODUPS) && he->flags & HIST_DUP)
 	    continue;
 	s = ZLETEXT(he);
-	if (metadiffer(s, (char *)line, cs) < 0 &&
-	    metadiffer(s, (char *)line, ll)) {
+	if (metadiffer(s, (char *)zleline, zlecs) < 0 &&
+	    metadiffer(s, (char *)zleline, zlell)) {
 	    if (--n <= 0) {
 		zle_setline(he);
-		cs = cpos;
+		zlecs = cpos;
 		return 0;
 	    }
 	}
@@ -1291,7 +1291,7 @@ int
 historybeginningsearchforward(char **args)
 {
     Histent he;
-    int cpos = cs;		/* save cursor position */
+    int cpos = zlecs;		/* save cursor position */
     int n = zmult;
     char *s;
 
@@ -1308,11 +1308,11 @@ historybeginningsearchforward(char **args)
 	if (isset(HISTFINDNODUPS) && he->flags & HIST_DUP)
 	    continue;
 	s = ZLETEXT(he);
-	if (metadiffer(s, (char *)line, cs) < (he->histnum == curhist) &&
-	    metadiffer(s, (char *)line, ll)) {
+	if (metadiffer(s, (char *)zleline, zlecs) < (he->histnum == curhist) &&
+	    metadiffer(s, (char *)zleline, zlell)) {
 	    if (--n <= 0) {
 		zle_setline(he);
-		cs = cpos;
+		zlecs = cpos;
 		return 0;
 	    }
 	}
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 549ee21af..028718761 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -37,6 +37,11 @@
 # undef HAVE_POLL
 #endif
 
+/* The input line assembled so far */
+
+/**/
+mod_export ZLE_STRING_T zleline;
+
 /* != 0 if in a shell function called from completion, such that read -[cl]  *
  * will work (i.e., the line is metafied, and the above word arrays are OK). */
 
@@ -694,7 +699,7 @@ zlecore(void)
 	selectlocalmap(NULL);
 	bindk = getkeycmd();
 	if (bindk) {
-	    if (!ll && isfirstln && !(zlereadflags & ZLRF_IGNOREEOF) &&
+	    if (!zlell && isfirstln && !(zlereadflags & ZLRF_IGNOREEOF) &&
 		lastchar == eofchar) {
 		/*
 		 * Slight hack: this relies on getkeycmd returning
@@ -713,9 +718,9 @@ zlecore(void)
 	    }
 	    handleprefixes();
 	    /* for vi mode, make sure the cursor isn't somewhere illegal */
-	    if (invicmdmode() && cs > findbol() &&
-		(cs == ll || line[cs] == '\n'))
-		cs--;
+	    if (invicmdmode() && zlecs > findbol() &&
+		(zlecs == zlell || zleline[zlecs] == '\n'))
+		zlecs--;
 	    if (undoing)
 		handleundo();
 	} else {
@@ -814,9 +819,9 @@ zleread(char **lp, char **rp, int flags, int context)
     zlecontext = context;
     histline = curhist;
     undoing = 1;
-    line = (unsigned char *)zalloc((linesz = 256) + 2);
-    *line = '\0';
-    virangeflag = lastcmd = done = cs = ll = mark = 0;
+    zleline = (unsigned char *)zalloc((linesz = 256) + 2);
+    *zleline = '\0';
+    virangeflag = lastcmd = done = zlecs = zlell = mark = 0;
     vichgflag = 0;
     viinsbegin = 0;
     statusline = NULL;
@@ -827,10 +832,10 @@ zleread(char **lp, char **rp, int flags, int context)
 	setline((char *)s);
 	zsfree((char *)s);
 	if (stackcs != -1) {
-	    cs = stackcs;
+	    zlecs = stackcs;
 	    stackcs = -1;
-	    if (cs > ll)
-		cs = ll;
+	    if (zlecs > zlell)
+		zlecs = zlell;
 	}
 	if (stackhist != -1) {
 	    histline = stackhist;
@@ -872,15 +877,15 @@ zleread(char **lp, char **rp, int flags, int context)
 
     freeundo();
     if (eofsent) {
-	free(line);
-	line = NULL;
+	free(zleline);
+	zleline = NULL;
     } else {
-	line[ll++] = '\n';
-	line = (unsigned char *) metafy((char *) line, ll, META_REALLOC);
+	zleline[zlell++] = '\n';
+	zleline = (unsigned char *) metafy((char *) zleline, zlell, META_REALLOC);
     }
     forget_edits();
     errno = old_errno;
-    return line;
+    return zleline;
 }
 
 /* execute a widget */
@@ -911,7 +916,7 @@ execzlefunc(Thingy func, char **args)
 	 * zlenoargs placeholder.
 	 */
 	if (keybuf[0] == eofchar && !keybuf[1] && args == zlenoargs &&
-	    !ll && isfirstln && (zlereadflags & ZLRF_IGNOREEOF)) {
+	    !zlell && isfirstln && (zlereadflags & ZLRF_IGNOREEOF)) {
 	    showmsg((!islogin) ? "zsh: use 'exit' to exit." :
 		    "zsh: use 'logout' to logout.");
 	    eofsent = 1;
@@ -1433,8 +1438,9 @@ setup_(UNUSED(Module m))
 {
     /* Set up editor entry points */
     trashzleptr = trashzle;
-    refreshptr = zrefresh;
-    spaceinlineptr = spaceinline;
+    zrefreshptr = zrefresh;
+    zleaddtolineptr = zleaddtoline;
+    zlegetlineptr = zlegetline;
     zlereadptr = zleread;
     zlesetkeymapptr = zlesetkeymap;
 
@@ -1517,8 +1523,9 @@ finish_(UNUSED(Module m))
 
     /* editor entry points */
     trashzleptr = noop_function;
-    refreshptr = noop_function;
-    spaceinlineptr = noop_function_int;
+    zrefreshptr = noop_function;
+    zleaddtolineptr = noop_function_int;
+    zlegetlineptr = NULL;
     zlereadptr = fallback_zleread;
     zlesetkeymapptr= noop_function_int;
 
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 935de58af..5667ba853 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -47,13 +47,13 @@ doinsert(char *str)
 
     if(insmode)
 	spaceinline(m * len);
-    else if(cs + m * len > ll)
-	spaceinline(cs + m * len - ll);
+    else if(zlecs + m * len > zlell)
+	spaceinline(zlecs + m * len - zlell);
     while(m--)
 	for(s = str; *s; s++)
-	    line[cs++] = *s == Meta ? *++s ^ 32 : *s;
+	    zleline[zlecs++] = *s == Meta ? *++s ^ 32 : *s;
     if(neg)
-	cs += zmult * len;
+	zlecs += zmult * len;
 }
 
 /**/
@@ -93,8 +93,8 @@ deletechar(char **args)
 	zmult = -zmult;
 	return ret;
     }
-    if (cs + zmult <= ll) {
-	cs += zmult;
+    if (zlecs + zmult <= zlell) {
+	zlecs += zmult;
 	backdel(zmult);
 	return 0;
     }
@@ -112,7 +112,7 @@ backwarddeletechar(char **args)
 	zmult = -zmult;
 	return ret;
     }
-    backdel(zmult > cs ? cs : zmult);
+    backdel(zmult > zlecs ? zlecs : zmult);
     return 0;
 }
 
@@ -125,12 +125,12 @@ killwholeline(UNUSED(char **args))
     if (n < 0)
 	return 1;
     while (n--) {
-	if ((fg = (cs && cs == ll)))
-	    cs--;
-	while (cs && line[cs - 1] != '\n')
-	    cs--;
-	for (i = cs; i != ll && line[i] != '\n'; i++);
-	forekill(i - cs + (i != ll), fg);
+	if ((fg = (zlecs && zlecs == zlell)))
+	    zlecs--;
+	while (zlecs && zleline[zlecs - 1] != '\n')
+	    zlecs--;
+	for (i = zlecs; i != zlell && zleline[i] != '\n'; i++);
+	forekill(i - zlecs + (i != zlell), fg);
     }
     clearlist = 1;
     return 0;
@@ -140,8 +140,8 @@ killwholeline(UNUSED(char **args))
 int
 killbuffer(UNUSED(char **args))
 {
-    cs = 0;
-    forekill(ll, 0);
+    zlecs = 0;
+    forekill(zlell, 0);
     clearlist = 1;
     return 0;
 }
@@ -160,11 +160,11 @@ backwardkillline(char **args)
 	return ret;
     }
     while (n--) {
-	if (cs && line[cs - 1] == '\n')
-	    cs--, i++;
+	if (zlecs && zleline[zlecs - 1] == '\n')
+	    zlecs--, i++;
 	else
-	    while (cs && line[cs - 1] != '\n')
-		cs--, i++;
+	    while (zlecs && zleline[zlecs - 1] != '\n')
+		zlecs--, i++;
     }
     forekill(i, 1);
     clearlist = 1;
@@ -177,17 +177,17 @@ gosmacstransposechars(UNUSED(char **args))
 {
     int cc;
 
-    if (cs < 2 || line[cs - 1] == '\n' || line[cs - 2] == '\n') {
-	if (cs == ll || line[cs] == '\n' ||
-	    ((cs + 1 == ll || line[cs + 1] == '\n') &&
-	     (!cs || line[cs - 1] == '\n'))) {
+    if (zlecs < 2 || zleline[zlecs - 1] == '\n' || zleline[zlecs - 2] == '\n') {
+	if (zlecs == zlell || zleline[zlecs] == '\n' ||
+	    ((zlecs + 1 == zlell || zleline[zlecs + 1] == '\n') &&
+	     (!zlecs || zleline[zlecs - 1] == '\n'))) {
 	    return 1;
 	}
-	cs += (cs == 0 || line[cs - 1] == '\n') ? 2 : 1;
+	zlecs += (zlecs == 0 || zleline[zlecs - 1] == '\n') ? 2 : 1;
     }
-    cc = line[cs - 2];
-    line[cs - 2] = line[cs - 1];
-    line[cs - 1] = cc;
+    cc = zleline[zlecs - 2];
+    zleline[zlecs - 2] = zleline[zlecs - 1];
+    zleline[zlecs - 1] = cc;
     return 0;
 }
 
@@ -202,30 +202,30 @@ transposechars(UNUSED(char **args))
     if (neg)
 	n = -n;
     while (n--) {
-	if (!(ct = cs) || line[cs - 1] == '\n') {
-	    if (ll == cs || line[cs] == '\n')
+	if (!(ct = zlecs) || zleline[zlecs - 1] == '\n') {
+	    if (zlell == zlecs || zleline[zlecs] == '\n')
 		return 1;
 	    if (!neg)
-		cs++;
+		zlecs++;
 	    ct++;
 	}
 	if (neg) {
-	    if (cs && line[cs - 1] != '\n') {
-		cs--;
-		if (ct > 1 && line[ct - 2] != '\n')
+	    if (zlecs && zleline[zlecs - 1] != '\n') {
+		zlecs--;
+		if (ct > 1 && zleline[ct - 2] != '\n')
 		    ct--;
 	    }
 	} else {
-	    if (cs != ll && line[cs] != '\n')
-		cs++;
+	    if (zlecs != zlell && zleline[zlecs] != '\n')
+		zlecs++;
 	}
-	if (ct == ll || line[ct] == '\n')
+	if (ct == zlell || zleline[ct] == '\n')
 	    ct--;
-	if (ct < 1 || line[ct - 1] == '\n')
+	if (ct < 1 || zleline[ct - 1] == '\n')
 	    return 1;
-	cc = line[ct - 1];
-	line[ct - 1] = line[ct];
-	line[ct] = cc;
+	cc = zleline[ct - 1];
+	zleline[ct - 1] = zleline[ct];
+	zleline[ct] = cc;
     }
     return 0;
 }
@@ -234,28 +234,28 @@ transposechars(UNUSED(char **args))
 int
 poundinsert(UNUSED(char **args))
 {
-    cs = 0;
+    zlecs = 0;
     vifirstnonblank(zlenoargs);
-    if (line[cs] != '#') {
+    if (zleline[zlecs] != '#') {
 	spaceinline(1);
-	line[cs] = '#';
-	cs = findeol();
-	while(cs != ll) {
-	    cs++;
+	zleline[zlecs] = '#';
+	zlecs = findeol();
+	while(zlecs != zlell) {
+	    zlecs++;
 	    vifirstnonblank(zlenoargs);
 	    spaceinline(1);
-	    line[cs] = '#';
-	    cs = findeol();
+	    zleline[zlecs] = '#';
+	    zlecs = findeol();
 	}
     } else {
 	foredel(1);
-	cs = findeol();
-	while(cs != ll) {
-	    cs++;
+	zlecs = findeol();
+	while(zlecs != zlell) {
+	    zlecs++;
 	    vifirstnonblank(zlenoargs);
-	    if(line[cs] == '#')
+	    if(zleline[zlecs] == '#')
 		foredel(1);
-	    cs = findeol();
+	    zlecs = findeol();
 	}
     }
     done = 1;
@@ -274,8 +274,8 @@ acceptline(UNUSED(char **args))
 int
 acceptandhold(UNUSED(char **args))
 {
-    zpushnode(bufstack, metafy((char *)line, ll, META_DUP));
-    stackcs = cs;
+    zpushnode(bufstack, metafy((char *)zleline, zlell, META_DUP));
+    stackcs = zlecs;
     done = 1;
     return 0;
 }
@@ -294,11 +294,11 @@ killline(char **args)
 	return ret;
     }
     while (n--) {
-	if (line[cs] == '\n')
-	    cs++, i++;
+	if (zleline[zlecs] == '\n')
+	    zlecs++, i++;
 	else
-	    while (cs != ll && line[cs] != '\n')
-		cs++, i++;
+	    while (zlecs != zlell && zleline[zlecs] != '\n')
+		zlecs++, i++;
     }
     backkill(i, 0);
     clearlist = 1;
@@ -309,12 +309,12 @@ killline(char **args)
 int
 killregion(UNUSED(char **args))
 {
-    if (mark > ll)
-	mark = ll;
-    if (mark > cs)
-	forekill(mark - cs, 0);
+    if (mark > zlell)
+	mark = zlell;
+    if (mark > zlecs)
+	forekill(mark - zlecs, 0);
     else
-	backkill(cs - mark, 1);
+	backkill(zlecs - mark, 1);
     return 0;
 }
 
@@ -322,12 +322,12 @@ killregion(UNUSED(char **args))
 int
 copyregionaskill(UNUSED(char **args))
 {
-    if (mark > ll)
-	mark = ll;
-    if (mark > cs)
-	cut(cs, mark - cs, 0);
+    if (mark > zlell)
+	mark = zlell;
+    if (mark > zlecs)
+	cut(zlecs, mark - zlecs, 0);
     else
-	cut(mark, cs - mark, 1);
+	cut(mark, zlecs - mark, 1);
     return 0;
 }
 
@@ -353,14 +353,14 @@ yank(UNUSED(char **args))
 	kctbuf = &cutbuf;
     if (!kctbuf->buf)
 	return 1;
-    mark = cs;
-    yankb = cs;
+    mark = zlecs;
+    yankb = zlecs;
     while (n--) {
 	kct = -1;
 	spaceinline(kctbuf->len);
-	memcpy((char *)line + cs, kctbuf->buf, kctbuf->len);
-	cs += kctbuf->len;
-	yanke = cs;
+	memcpy((char *)zleline + zlecs, kctbuf->buf, kctbuf->len);
+	zlecs += kctbuf->len;
+	yanke = zlecs;
     }
     return 0;
 }
@@ -414,13 +414,13 @@ yankpop(UNUSED(char **args))
 	 */
     } while (!buf->buf || !*buf->buf);
 
-    cs = yankb;
+    zlecs = yankb;
     foredel(yanke - yankb);
     cc = buf->len;
     spaceinline(cc);
-    memcpy((char *)line + cs, buf->buf, cc);
-    cs += cc;
-    yanke = cs;
+    memcpy((char *)zleline + zlecs, buf->buf, cc);
+    zlecs += cc;
+    yanke = zlecs;
     return 0;
 }
 
@@ -439,9 +439,9 @@ whatcursorposition(UNUSED(char **args))
     char msg[100];
     char *s = msg;
     int bol = findbol();
-    int c = STOUC(line[cs]);
+    int c = STOUC(zleline[zlecs]);
 
-    if (cs == ll)
+    if (zlecs == zlell)
 	strucpy(&s, "EOF");
     else {
 	strucpy(&s, "Char: ");
@@ -465,8 +465,8 @@ whatcursorposition(UNUSED(char **args))
 	sprintf(s, " (0%o, %d, 0x%x)", c, c, c);
 	s += strlen(s);
     }
-    sprintf(s, "  point %d of %d(%d%%)  column %d", cs+1, ll+1,
-	    ll ? 100 * cs / ll : 0, cs - bol);
+    sprintf(s, "  point %d of %d(%d%%)  column %d", zlecs+1, zlell+1,
+	    zlell ? 100 * zlecs / zlell : 0, zlecs - bol);
     showmsg(msg);
     return 0;
 }
@@ -572,18 +572,18 @@ copyprevword(UNUSED(char **args))
 {
     int len, t0;
 
-    for (t0 = cs - 1; t0 >= 0; t0--)
-	if (iword(line[t0]))
+    for (t0 = zlecs - 1; t0 >= 0; t0--)
+	if (iword(zleline[t0]))
 	    break;
     for (; t0 >= 0; t0--)
-	if (!iword(line[t0]))
+	if (!iword(zleline[t0]))
 	    break;
     if (t0)
 	t0++;
-    len = cs - t0;
+    len = zlecs - t0;
     spaceinline(len);
-    memcpy((char *)&line[cs], (char *)&line[t0], len);
-    cs += len;
+    memcpy((char *)&zleline[zlecs], (char *)&zleline[t0], len);
+    zlecs += len;
     return 0;
 }
 
@@ -607,8 +607,8 @@ copyprevshellword(UNUSED(char **args))
 	int len = strlen(p);
 
 	spaceinline(len);
-	memcpy(line + cs, p, len);
-	cs += len;
+	memcpy(zleline + zlecs, p, len);
+	zlecs += len;
     }
     return 0;
 }
@@ -628,21 +628,21 @@ quoteregion(UNUSED(char **args))
     char *str;
     size_t len;
 
-    if (mark > ll)
-	mark = ll;
-    if (mark < cs) {
+    if (mark > zlell)
+	mark = zlell;
+    if (mark < zlecs) {
 	int tmp = mark;
-	mark = cs;
-	cs = tmp;
+	mark = zlecs;
+	zlecs = tmp;
     }
-    str = (char *)hcalloc(len = mark - cs);
-    memcpy(str, (char *)&line[cs], len);
+    str = (char *)hcalloc(len = mark - zlecs);
+    memcpy(str, (char *)&zleline[zlecs], len);
     foredel(len);
     str = makequote(str, &len);
     spaceinline(len);
-    memcpy((char *)&line[cs], str, len);
-    mark = cs;
-    cs += len;
+    memcpy((char *)&zleline[zlecs], str, len);
+    mark = zlecs;
+    zlecs += len;
     return 0;
 }
 
@@ -651,12 +651,12 @@ int
 quoteline(UNUSED(char **args))
 {
     char *str;
-    size_t len = ll;
+    size_t len = zlell;
 
-    str = makequote((char *)line, &len);
+    str = makequote((char *)zleline, &len);
     sizeline(len);
-    memcpy(line, str, len);
-    cs = ll = len;
+    memcpy(zleline, str, len);
+    zlecs = zlell = len;
     return 0;
 }
 
diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c
index 23db9dc4e..48e9dd64f 100644
--- a/Src/Zle/zle_move.c
+++ b/Src/Zle/zle_move.c
@@ -46,13 +46,13 @@ beginningofline(char **args)
 	return ret;
     }
     while (n--) {
-	if (cs == 0)
+	if (zlecs == 0)
 	    return 0;
-	if (line[cs - 1] == '\n')
-	    if (!--cs)
+	if (zleline[zlecs - 1] == '\n')
+	    if (!--zlecs)
 		return 0;
-	while (cs && line[cs - 1] != '\n')
-	    cs--;
+	while (zlecs && zleline[zlecs - 1] != '\n')
+	    zlecs--;
     }
     return 0;
 }
@@ -71,15 +71,15 @@ endofline(char **args)
 	return ret;
     }
     while (n--) {
-	if (cs >= ll) {
-	    cs = ll;
+	if (zlecs >= zlell) {
+	    zlecs = zlell;
 	    return 0;
 	}
-	if (line[cs] == '\n')
-	    if (++cs == ll)
+	if (zleline[zlecs] == '\n')
+	    if (++zlecs == zlell)
 		return 0;
-	while (cs != ll && line[cs] != '\n')
-	    cs++;
+	while (zlecs != zlell && zleline[zlecs] != '\n')
+	    zlecs++;
     }
     return 0;
 }
@@ -98,13 +98,13 @@ beginningoflinehist(char **args)
 	return ret;
     }
     while (n) {
-	if (cs == 0)
+	if (zlecs == 0)
 	    break;
-	if (line[cs - 1] == '\n')
-	    if (!--cs)
+	if (zleline[zlecs - 1] == '\n')
+	    if (!--zlecs)
 		break;
-	while (cs && line[cs - 1] != '\n')
-	    cs--;
+	while (zlecs && zleline[zlecs - 1] != '\n')
+	    zlecs--;
 	n--;
     }
     if (n) {
@@ -113,7 +113,7 @@ beginningoflinehist(char **args)
 	zmult = n;
 	ret = uphistory(args);
 	zmult = m;
-	cs = 0;
+	zlecs = 0;
 	return ret;
     }
     return 0;
@@ -133,15 +133,15 @@ endoflinehist(char **args)
 	return ret;
     }
     while (n) {
-	if (cs >= ll) {
-	    cs = ll;
+	if (zlecs >= zlell) {
+	    zlecs = zlell;
 	    break;
 	}
-	if (line[cs] == '\n')
-	    if (++cs == ll)
+	if (zleline[zlecs] == '\n')
+	    if (++zlecs == zlell)
 		break;
-	while (cs != ll && line[cs] != '\n')
-	    cs++;
+	while (zlecs != zlell && zleline[zlecs] != '\n')
+	    zlecs++;
 	n--;
     }
     if (n) {
@@ -159,11 +159,11 @@ endoflinehist(char **args)
 int
 forwardchar(UNUSED(char **args))
 {
-    cs += zmult;
-    if (cs > ll)
-	cs = ll;
-    if (cs < 0)
-	cs = 0;
+    zlecs += zmult;
+    if (zlecs > zlell)
+	zlecs = zlell;
+    if (zlecs < 0)
+	zlecs = 0;
     return 0;
 }
 
@@ -171,11 +171,11 @@ forwardchar(UNUSED(char **args))
 int
 backwardchar(UNUSED(char **args))
 {
-    cs -= zmult;
-    if (cs > ll)
-	cs = ll;
-    if (cs < 0)
-	cs = 0;
+    zlecs -= zmult;
+    if (zlecs > zlell)
+	zlecs = zlell;
+    if (zlecs < 0)
+	zlecs = 0;
     return 0;
 }
 
@@ -183,7 +183,7 @@ backwardchar(UNUSED(char **args))
 int
 setmarkcommand(UNUSED(char **args))
 {
-    mark = cs;
+    mark = zlecs;
     return 0;
 }
 
@@ -194,10 +194,10 @@ exchangepointandmark(UNUSED(char **args))
     int x;
 
     x = mark;
-    mark = cs;
-    cs = x;
-    if (cs > ll)
-	cs = ll;
+    mark = zlecs;
+    zlecs = x;
+    if (zlecs > zlell)
+	zlecs = zlell;
     return 0;
 }
 
@@ -209,13 +209,13 @@ vigotocolumn(UNUSED(char **args))
 
     findline(&x, &y);
     if (zmult >= 0)
-	cs = x + zmult - (zmult > 0);
+	zlecs = x + zmult - (zmult > 0);
     else
-	cs = y + zmult;
-    if (cs > y)
-	cs = y;
-    if (cs < x)
-	cs = x;
+	zlecs = y + zmult;
+    if (zlecs > y)
+	zlecs = y;
+    if (zlecs < x)
+	zlecs = x;
     return 0;
 }
 
@@ -223,15 +223,15 @@ vigotocolumn(UNUSED(char **args))
 int
 vimatchbracket(UNUSED(char **args))
 {
-    int ocs = cs, dir, ct;
+    int ocs = zlecs, dir, ct;
     unsigned char oth, me;
 
   otog:
-    if (cs == ll || line[cs] == '\n') {
-	cs = ocs;
+    if (zlecs == zlell || zleline[zlecs] == '\n') {
+	zlecs = ocs;
 	return 1;
     }
-    switch (me = line[cs]) {
+    switch (me = zleline[zlecs]) {
     case '{':
 	dir = 1;
 	oth = '}';
@@ -260,22 +260,22 @@ vimatchbracket(UNUSED(char **args))
 	oth = '[';
 	break;
     default:
-	cs++;
+	zlecs++;
 	goto otog;
     }
     ct = 1;
-    while (cs >= 0 && cs < ll && ct) {
-	cs += dir;
-	if (line[cs] == oth)
+    while (zlecs >= 0 && zlecs < zlell && ct) {
+	zlecs += dir;
+	if (zleline[zlecs] == oth)
 	    ct--;
-	else if (line[cs] == me)
+	else if (zleline[zlecs] == me)
 	    ct++;
     }
-    if (cs < 0 || cs >= ll) {
-	cs = ocs;
+    if (zlecs < 0 || zlecs >= zlell) {
+	zlecs = ocs;
 	return 1;
     } else if(dir > 0 && virangeflag)
-	cs++;
+	zlecs++;
     return 0;
 }
 
@@ -293,10 +293,10 @@ viforwardchar(char **args)
 	zmult = n;
 	return ret;
     }
-    if (cs >= lim)
+    if (zlecs >= lim)
 	return 1;
-    while (n-- && cs < lim)
-	cs++;
+    while (n-- && zlecs < lim)
+	zlecs++;
     return 0;
 }
 
@@ -313,12 +313,12 @@ vibackwardchar(char **args)
 	zmult = n;
 	return ret;
     }
-    if (cs == findbol())
+    if (zlecs == findbol())
 	return 1;
     while (n--) {
-	cs--;
-	if (cs < 0 || line[cs] == '\n') {
-	    cs++;
+	zlecs--;
+	if (zlecs < 0 || zleline[zlecs] == '\n') {
+	    zlecs++;
 	    break;
 	}
     }
@@ -329,18 +329,18 @@ vibackwardchar(char **args)
 int
 viendofline(UNUSED(char **args))
 {
-    int oldcs = cs, n = zmult;
+    int oldcs = zlecs, n = zmult;
 
     if (n < 1)
 	return 1;
     while(n--) {
-	if (cs > ll) {
-	    cs = oldcs;
+	if (zlecs > zlell) {
+	    zlecs = oldcs;
 	    return 1;
 	}
-	cs = findeol() + 1;
+	zlecs = findeol() + 1;
     }
-    cs--;
+    zlecs--;
     lastcol = 1<<30;
     return 0;
 }
@@ -349,7 +349,7 @@ viendofline(UNUSED(char **args))
 int
 vibeginningofline(UNUSED(char **args))
 {
-    cs = findbol();
+    zlecs = findbol();
     return 0;
 }
 
@@ -407,7 +407,7 @@ vifindprevcharskip(char **args)
 int
 virepeatfind(char **args)
 {
-    int ocs = cs, n = zmult;
+    int ocs = zlecs, n = zmult;
 
     if (!vfinddir)
 	return 1;
@@ -420,16 +420,16 @@ virepeatfind(char **args)
     }
     while (n--) {
 	do
-	    cs += vfinddir;
-	while (cs >= 0 && cs < ll && line[cs] != vfindchar && line[cs] != '\n');
-	if (cs < 0 || cs >= ll || line[cs] == '\n') {
-	    cs = ocs;
+	    zlecs += vfinddir;
+	while (zlecs >= 0 && zlecs < zlell && zleline[zlecs] != vfindchar && zleline[zlecs] != '\n');
+	if (zlecs < 0 || zlecs >= zlell || zleline[zlecs] == '\n') {
+	    zlecs = ocs;
 	    return 1;
 	}
     }
-    cs += tailadd;
+    zlecs += tailadd;
     if (vfinddir == 1 && virangeflag)
-	cs++;
+	zlecs++;
     return 0;
 }
 
@@ -455,9 +455,9 @@ virevrepeatfind(char **args)
 int
 vifirstnonblank(UNUSED(char **args))
 {
-    cs = findbol();
-    while (cs != ll && iblank(line[cs]))
-	cs++;
+    zlecs = findbol();
+    while (zlecs != zlell && iblank(zleline[zlecs]))
+	zlecs++;
     return 0;
 }
 
@@ -471,7 +471,7 @@ visetmark(UNUSED(char **args))
     if (ch < 'a' || ch > 'z')
 	return 1;
     ch -= 'a';
-    vimarkcs[ch] = cs;
+    vimarkcs[ch] = zlecs;
     vimarkline[ch] = histline;
     return 0;
 }
@@ -496,9 +496,9 @@ vigotomark(UNUSED(char **args))
 	vimarkline[ch] = 0;
 	return 1;
     }
-    cs = vimarkcs[ch];
-    if (cs > ll)
-	cs = ll;
+    zlecs = vimarkcs[ch];
+    if (zlecs > zlell)
+	zlecs = zlell;
     return 0;
 }
 
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index 4a12dc2e7..afad1355b 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -175,14 +175,14 @@ static void
 set_buffer(UNUSED(Param pm), char *x)
 {
     if(x) {
-	unmetafy(x, &ll);
-	sizeline(ll);
-	strcpy((char *)line, x);
+	unmetafy(x, &zlell);
+	sizeline(zlell);
+	strcpy((char *)zleline, x);
 	zsfree(x);
-	if(cs > ll)
-	    cs = ll;
+	if(zlecs > zlell)
+	    zlecs = zlell;
     } else
-	cs = ll = 0;
+	zlecs = zlell = 0;
     fixsuffix();
     menucmp = 0;
 }
@@ -191,7 +191,7 @@ set_buffer(UNUSED(Param pm), char *x)
 static char *
 get_buffer(UNUSED(Param pm))
 {
-    return metafy((char *)line, ll, META_HEAPDUP);
+    return metafy((char *)zleline, zlell, META_HEAPDUP);
 }
 
 /**/
@@ -199,11 +199,11 @@ static void
 set_cursor(UNUSED(Param pm), zlong x)
 {
     if(x < 0)
-	cs = 0;
-    else if(x > ll)
-	cs = ll;
+	zlecs = 0;
+    else if(x > zlell)
+	zlecs = zlell;
     else
-	cs = x;
+	zlecs = x;
     fixsuffix();
     menucmp = 0;
 }
@@ -212,7 +212,7 @@ set_cursor(UNUSED(Param pm), zlong x)
 static zlong
 get_cursor(UNUSED(Param pm))
 {
-    return cs;
+    return zlecs;
 }
 
 /**/
@@ -221,8 +221,8 @@ set_mark(UNUSED(Param pm), zlong x)
 {
     if (x < 0)
 	mark = 0;
-    else if (x > ll)
-	mark = ll;
+    else if (x > zlell)
+	mark = zlell;
     else
 	mark = x;
 }
@@ -245,11 +245,11 @@ set_lbuffer(UNUSED(Param pm), char *x)
 	unmetafy(y = x, &len);
     else
 	y = "", len = 0;
-    sizeline(ll - cs + len);
-    memmove(line + len, line + cs, ll - cs);
-    memcpy(line, y, len);
-    ll = ll - cs + len;
-    cs = len;
+    sizeline(zlell - zlecs + len);
+    memmove(zleline + len, zleline + zlecs, zlell - zlecs);
+    memcpy(zleline, y, len);
+    zlell = zlell - zlecs + len;
+    zlecs = len;
     zsfree(x);
     fixsuffix();
     menucmp = 0;
@@ -259,7 +259,7 @@ set_lbuffer(UNUSED(Param pm), char *x)
 static char *
 get_lbuffer(UNUSED(Param pm))
 {
-    return metafy((char *)line, cs, META_HEAPDUP);
+    return metafy((char *)zleline, zlecs, META_HEAPDUP);
 }
 
 /**/
@@ -273,8 +273,8 @@ set_rbuffer(UNUSED(Param pm), char *x)
 	unmetafy(y = x, &len);
     else
 	y = "", len = 0;
-    sizeline(ll = cs + len);
-    memcpy(line + cs, y, len);
+    sizeline(zlell = zlecs + len);
+    memcpy(zleline + zlecs, y, len);
     zsfree(x);
     fixsuffix();
     menucmp = 0;
@@ -284,7 +284,7 @@ set_rbuffer(UNUSED(Param pm), char *x)
 static char *
 get_rbuffer(UNUSED(Param pm))
 {
-    return metafy((char *)line + cs, ll - cs, META_HEAPDUP);
+    return metafy((char *)zleline + zlecs, zlell - zlecs, META_HEAPDUP);
 }
 
 /**/
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index c0da11c89..2a72e6e8e 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -304,20 +304,20 @@ zrefresh(void)
 
     if (predisplaylen || postdisplaylen) {
 	/* There is extra text to display at the start or end of the line */
-	tmpline = zalloc(ll + predisplaylen + postdisplaylen);
+	tmpline = zalloc(zlell + predisplaylen + postdisplaylen);
 	if (predisplaylen)
 	    memcpy(tmpline, predisplay, predisplaylen);
-	if (ll)
-	    memcpy(tmpline+predisplaylen, line, ll);
+	if (zlell)
+	    memcpy(tmpline+predisplaylen, zleline, zlell);
 	if (postdisplaylen)
-	    memcpy(tmpline+predisplaylen+ll, postdisplay, postdisplaylen);
-	tmpcs = cs + predisplaylen;
-	tmpll = predisplaylen + ll + postdisplaylen;
+	    memcpy(tmpline+predisplaylen+zlell, postdisplay, postdisplaylen);
+	tmpcs = zlecs + predisplaylen;
+	tmpll = predisplaylen + zlell + postdisplaylen;
 	tmpalloced = 1;
     } else {
-	tmpline = line;
-	tmpcs = cs;
-	tmpll = ll;
+	tmpline = zleline;
+	tmpcs = zlecs;
+	tmpll = zlell;
 	tmpalloced = 0;
     }
 
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 6d5723c39..a4d87dfea 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -30,17 +30,19 @@
 #include "zle.mdh"
 #include "zle_tricky.pro"
 
-/* The main part of ZLE maintains the line being edited as binary data, *
- * but here, where we interface with the lexer and other bits of zsh,   *
- * we need the line metafied.  The technique used is quite simple: on   *
- * entry to the expansion/completion system, we metafy the line in      *
- * place, adjusting ll and cs to match.  All completion and expansion   *
- * is done on the metafied line.  Immediately before returning, the     *
- * line is unmetafied again, changing ll and cs back.  (ll and cs might *
- * have changed during completion, so they can't be merely saved and    *
- * restored.)  The various indexes into the line that are used in this  *
- * file only are not translated: they remain indexes into the metafied  *
- * line.                                                                */
+/*
+ * The main part of ZLE maintains the line being edited as binary data,
+ * but here, where we interface with the lexer and other bits of zsh, we
+ * need the line metafied.  The technique used is quite simple: on entry
+ * to the expansion/completion system, we metafy the line in place,
+ * adjusting zlell and zlecs to match.  All completion and expansion is
+ * done on the metafied line.  Immediately before returning, the line is
+ * unmetafied again, changing zlell and zlecs back.  (zlell and zlecs
+ * might have changed during completion, so they can't be merely saved
+ * and restored.)  The various indexes into the line that are used in
+ * this file only are not translated: they remain indexes into the
+ * metafied line.
+ */
 
 #define inststr(X) inststrlen((X),1,-1)
 
@@ -157,11 +159,11 @@ int hascompwidgets;
 static int
 usetab(void)
 {
-    unsigned char *s = line + cs - 1;
+    unsigned char *s = zleline + zlecs - 1;
 
     if (keybuf[0] != '\t' || keybuf[1])
 	return 0;
-    for (; s >= line && *s != '\n'; s--)
+    for (; s >= zleline && *s != '\n'; s--)
 	if (*s != '\t' && *s != ' ')
 	    return 0;
     if (compfunc) {
@@ -248,7 +250,7 @@ deletecharorlist(char **args)
     useglob = isset(GLOBCOMPLETE);
     wouldinstab = 0;
 
-    if (cs != ll) {
+    if (zlecs != zlell) {
 	fixsuffix();
 	invalidatelist();
 	return deletechar(args);
@@ -582,22 +584,22 @@ docomplete(int lst)
     }
     metafy_line();
 
-    ocs = cs;
-    origline = dupstring((char *) line);
-    origcs = cs;
-    origll = ll;
+    ocs = zlecs;
+    origline = dupstring((char *) zleline);
+    origcs = zlecs;
+    origll = zlell;
     if (!isfirstln && chline != NULL) {
 	/* If we are completing in a multi-line buffer (which was not  *
 	 * taken from the history), we have to prepend the stuff saved *
 	 * in chline to the contents of line.                          */
 
-	ol = dupstring((char *)line);
+	ol = dupstring((char *)zleline);
 	/* Make sure that chline is zero-terminated. */
 	*hptr = '\0';
-	cs = 0;
+	zlecs = 0;
 	inststr(chline);
-	chl = cs;
-	cs += ocs;
+	chl = zlecs;
+	zlecs += ocs;
     } else
 	ol = NULL;
     inwhat = IN_NOTHING;
@@ -611,35 +613,35 @@ docomplete(int lst)
      * NOTE: get_comp_string() calls pushheap(), but not popheap(). */
     noerrs = 1;
     s = get_comp_string();
-    DPUTS(wb < 0 || cs < wb || cs > we,
-	  "BUG: 0 <= wb <= cs <= we is not true!");
+    DPUTS(wb < 0 || zlecs < wb || zlecs > we,
+	  "BUG: 0 <= wb <= zlecs <= we is not true!");
     noerrs = ne;
     /* For vi mode, reset the start-of-insertion pointer to the beginning *
      * of the word being completed, if it is currently later.  Vi itself  *
      * would never change the pointer in the middle of an insertion, but  *
      * then vi doesn't have completion.  More to the point, this is only  *
      * an emulation.                                                      */
-    if (viinsbegin > ztrsub((char *) line + wb, (char *) line))
-	viinsbegin = ztrsub((char *) line + wb, (char *) line);
+    if (viinsbegin > ztrsub((char *) zleline + wb, (char *) zleline))
+	viinsbegin = ztrsub((char *) zleline + wb, (char *) zleline);
     /* If we added chline to the line buffer, reset the original contents. */
     if (ol) {
-	cs -= chl;
+	zlecs -= chl;
 	wb -= chl;
 	we -= chl;
 	if (wb < 0) {
-	    strcpy((char *) line, ol);
-	    ll = strlen((char *) line);
-	    cs = ocs;
+	    strcpy((char *) zleline, ol);
+	    zlell = strlen((char *) zleline);
+	    zlecs = ocs;
 	    popheap();
 	    unmetafy_line();
 	    zsfree(s);
 	    active = 0;
 	    return 1;
 	}
-	ocs = cs;
-	cs = 0;
+	ocs = zlecs;
+	zlecs = 0;
 	foredel(chl);
-	cs = ocs;
+	zlecs = ocs;
     }
     freeheap();
     /* Save the lexer state, in case the completion code uses the lexer *
@@ -683,7 +685,7 @@ docomplete(int lst)
 		    if (*q == String && q[1] != Inpar && q[1] != Inbrack) {
 			if (*++q == Inbrace) {
 			    if (! skipparens(Inbrace, Outbrace, &q) &&
-				q == s + cs - wb)
+				q == s + zlecs - wb)
 				lst = COMP_EXPAND;
 			} else {
 			    char *t, sav, sav2;
@@ -714,7 +716,7 @@ docomplete(int lst)
 				    q++;
 			    sav = *q;
 			    *q = '\0';
-			    if (cs - wb == q - s &&
+			    if (zlecs - wb == q - s &&
 				(idigit(sav2) || checkparams(t)))
 				lst = COMP_EXPAND;
 			    *q = sav;
@@ -724,7 +726,7 @@ docomplete(int lst)
 			    lst = COMP_COMPLETE;
 		    } else
 			break;
-		} while (q < s + cs - wb);
+		} while (q < s + zlecs - wb);
 	    if (lst == COMP_EXPAND_COMPLETE) {
 		/* If it is still not clear if we should use expansion or   *
 		 * completion and there is a `$' or a backtick in the word, *
@@ -749,7 +751,7 @@ docomplete(int lst)
 	    for (q = w; *q; q++)
 		if (INULL(*q))
 		    *q = Nularg;
-	    cs = wb;
+	    zlecs = wb;
 	    foredel(we - wb);
 
 	    untokenize(x = ox = dupstring(w));
@@ -764,8 +766,8 @@ docomplete(int lst)
 	    /* Do expansion. */
 	    char *ol = (olst == COMP_EXPAND ||
                         olst == COMP_EXPAND_COMPLETE) ?
-		dupstring((char *)line) : (char *)line;
-	    int ocs = cs, ne = noerrs;
+		dupstring((char *)zleline) : (char *)zleline;
+	    int ocs = zlecs, ne = noerrs;
 
 	    noerrs = 1;
 	    ret = doexpansion(origword, lst, olst, lincmd);
@@ -775,8 +777,8 @@ docomplete(int lst)
 	    /* If expandorcomplete was invoked and the expansion didn't *
 	     * change the command line, do completion.                  */
 	    if (olst == COMP_EXPAND_COMPLETE &&
-		!strcmp(ol, (char *)line)) {
-		cs = ocs;
+		!strcmp(ol, (char *)zleline)) {
+		zlecs = ocs;
 		errflag = 0;
 
 		if (!compfunc) {
@@ -797,15 +799,15 @@ docomplete(int lst)
             } else {
                 if (ret)
                     clearlist = 1;
-                if (!strcmp(ol, (char *)line)) {
+                if (!strcmp(ol, (char *)zleline)) {
                     /* We may have removed some quotes. For completion, other
                      * parts of the code re-install them, but for expansion
                      * we have to do it here. */
-                    cs = 0;
-                    foredel(ll);
+                    zlecs = 0;
+                    foredel(zlell);
                     spaceinline(origll);
-                    memcpy(line, origline, origll);
-                    cs = origcs;
+                    memcpy(zleline, origline, origll);
+                    zlecs = origcs;
                 }
             }
 	} else
@@ -854,20 +856,23 @@ addx(char **ptmp)
 {
     int addspace = 0;
 
-    if (!line[cs] || line[cs] == '\n' ||
-	(iblank(line[cs]) && (!cs || line[cs-1] != '\\')) ||
-	line[cs] == ')' || line[cs] == '`' || line[cs] == '}' ||
-	line[cs] == ';' || line[cs] == '|' || line[cs] == '&' ||
-	line[cs] == '>' || line[cs] == '<' ||
-	(instring && (line[cs] == '"' || line[cs] == '\'')) ||
-	(addspace = (comppref && !iblank(line[cs])))) {
-	*ptmp = (char *)line;
-	line = (unsigned char *)zhalloc(strlen((char *)line) + 3 + addspace);
-	memcpy(line, *ptmp, cs);
-	line[cs] = 'x';
+    if (!zleline[zlecs] || zleline[zlecs] == '\n' ||
+	(iblank(zleline[zlecs]) && (!zlecs || zleline[zlecs-1] != '\\')) ||
+	zleline[zlecs] == ')' || zleline[zlecs] == '`' ||
+	zleline[zlecs] == '}' ||
+	zleline[zlecs] == ';' || zleline[zlecs] == '|' ||
+	zleline[zlecs] == '&' ||
+	zleline[zlecs] == '>' || zleline[zlecs] == '<' ||
+	(instring && (zleline[zlecs] == '"' || zleline[zlecs] == '\'')) ||
+	(addspace = (comppref && !iblank(zleline[zlecs])))) {
+	*ptmp = (char *)zleline;
+	zleline = (unsigned char *)zhalloc(strlen((char *)zleline) + 3 +
+					   addspace);
+	memcpy(zleline, *ptmp, zlecs);
+	zleline[zlecs] = 'x';
 	if (addspace)
-	    line[cs+1] = ' ';
-	strcpy((char *)line + cs + 1 + addspace, (*ptmp) + cs);
+	    zleline[zlecs+1] = ' ';
+	strcpy((char *)zleline + zlecs + 1 + addspace, (*ptmp) + zlecs);
 	addedx = 1 + addspace;
     } else {
 	addedx = 0;
@@ -889,7 +894,7 @@ dupstrspace(const char *str)
 }
 
 /* These functions metafy and unmetafy the ZLE buffer, as described at the *
- * top of this file.  Note that ll and cs are translated.  They *must* be  *
+ * top of this file.  Note that zlell and zlecs are translated.  They *must* be  *
  * called in matching pairs, around all the expansion/completion code.     *
  * Currently, there are four pairs: in history expansion, in the main      *
  * completion function, and one in each of the middle-of-menu-completion   *
@@ -899,24 +904,24 @@ dupstrspace(const char *str)
 mod_export void
 metafy_line(void)
 {
-    int len = ll;
+    int len = zlell;
     char *s;
 
-    for (s = (char *) line; s < (char *) line + ll;)
+    for (s = (char *) zleline; s < (char *) zleline + zlell;)
 	if (imeta(*s++))
 	    len++;
     sizeline(len);
-    (void) metafy((char *) line, ll, META_NOALLOC);
-    ll = len;
-    cs = metalen((char *) line, cs);
+    (void) metafy((char *) zleline, zlell, META_NOALLOC);
+    zlell = len;
+    zlecs = metalen((char *) zleline, zlecs);
 }
 
 /**/
 mod_export void
 unmetafy_line(void)
 {
-    cs = ztrsub((char *) line + cs, (char *) line);
-    (void) unmetafy((char *) line, &ll);
+    zlecs = ztrsub((char *) zleline + zlecs, (char *) zleline);
+    (void) unmetafy((char *) zleline, &zlell);
 }
 
 /* Free a brinfo list. */
@@ -1011,7 +1016,7 @@ get_comp_string(void)
      * "...", `...`, or ((...)). Nowadays this is only used to find   *
      * out if we are inside `...`.                                    */
 
-    for (i = j = k = 0, p = (char *)line; p < (char *)line + cs; p++)
+    for (i = j = k = 0, p = (char *)zleline; p < (char *)zleline + zlecs; p++)
 	if (*p == '`' && !(k & 1))
 	    i++;
 	else if (*p == '\"' && !(k & 1) && !(i & 1))
@@ -1023,7 +1028,7 @@ get_comp_string(void)
     inbackt = (i & 1);
     instring = 0;
     addx(&tmp);
-    linptr = (char *)line;
+    linptr = (char *)zleline;
     pushheap();
 
  start:
@@ -1132,14 +1137,14 @@ get_comp_string(void)
 	    tt = tokstr ? dupstring(tokstr) : NULL;
 
             if (isset(RCQUOTES) && *tt == Snull) {
-                char *p, *e = tt + cs - wb;
+                char *p, *e = tt + zlecs - wb;
                 for (p = tt; *p && p < e; p++)
                     if (*p == '\'')
                         qsub++;
             }
 	    /* If we added a `x', remove it. */
 	    if (addedx && tt)
-		chuck(tt + cs - wb - qsub);
+		chuck(tt + zlecs - wb - qsub);
 	    tt0 = tok;
 	    /* Store the number of this word. */
 	    clwpos = i;
@@ -1187,8 +1192,8 @@ get_comp_string(void)
 	/* If this is the word the cursor is in and we added a `x', *
 	 * remove it.                                               */
 	if (clwpos == i++ && addedx)
-	    chuck(&clwords[i - 1][((cs - wb - qsub) >= sl) ?
-				 (sl - 1) : (cs - wb - qsub)]);
+	    chuck(&clwords[i - 1][((zlecs - wb - qsub) >= sl) ?
+				 (sl - 1) : (zlecs - wb - qsub)]);
     } while (tok != LEXERR && tok != ENDINPUT &&
 	     (tok != SEPER || (zleparse && !tt0)));
     /* Calculate the number of words stored in the clwords array. */
@@ -1210,13 +1215,13 @@ get_comp_string(void)
 	/* We are in command or process substitution if we are not in
 	 * a $((...)). */
 	if (parend >= 0 && !tmp)
-	    line = (unsigned char *) dupstring(tmp = (char *)line);
-	linptr = (char *) line + ll + addedx - parbegin + 1;
-	if ((linptr - (char *) line) < 3 || *linptr != '(' ||
+	    zleline = (unsigned char *) dupstring(tmp = (char *)zleline);
+	linptr = (char *) zleline + zlell + addedx - parbegin + 1;
+	if ((linptr - (char *) zleline) < 3 || *linptr != '(' ||
 	    linptr[-1] != '(' || linptr[-2] != '$') {
 	    if (parend >= 0) {
-		ll -= parend;
-		line[ll + addedx] = '\0';
+		zlell -= parend;
+		zleline[zlell + addedx] = '\0';
 	    }
 	    lexrestore();
 	    tt = NULL;
@@ -1229,7 +1234,7 @@ get_comp_string(void)
     else if (!t0 || t0 == ENDINPUT) {
 	/* There was no word (empty line). */
 	s = ztrdup("");
-	we = wb = cs;
+	we = wb = zlecs;
 	clwpos = clwnum;
 	t0 = STRING;
     } else if (t0 == STRING) {
@@ -1250,7 +1255,7 @@ get_comp_string(void)
 	*s = sav;
         if (*s == '+')
             s++;
-	if (skipparens(Inbrack, Outbrack, &s) > 0 || s > tt + cs - wb) {
+	if (skipparens(Inbrack, Outbrack, &s) > 0 || s > tt + zlecs - wb) {
 	    s = NULL;
 	    inwhat = IN_MATH;
 	    if ((keypm = (Param) paramtab->getnode(paramtab, varname)) &&
@@ -1259,7 +1264,7 @@ get_comp_string(void)
 	    else
 		insubscr = 1;
 	} else if (*s == '=') {
-            if (cs > wb + (s - tt)) {
+            if (zlecs > wb + (s - tt)) {
                 s++;
                 wb += s - tt;
                 s = ztrdup(s);
@@ -1280,17 +1285,17 @@ get_comp_string(void)
 	}
 	lincmd = 1;
     }
-    if (we > ll)
-	we = ll;
-    tt = (char *)line;
+    if (we > zlell)
+	we = zlell;
+    tt = (char *)zleline;
     if (tmp) {
-	line = (unsigned char *)tmp;
-	ll = strlen((char *)line);
+	zleline = (unsigned char *)tmp;
+	zlell = strlen((char *)zleline);
     }
     if (t0 != STRING && inwhat != IN_MATH) {
 	if (tmp) {
 	    tmp = NULL;
-	    linptr = (char *)line;
+	    linptr = (char *)zleline;
 	    lexrestore();
 	    addedx = 0;
 	    goto start;
@@ -1311,7 +1316,7 @@ get_comp_string(void)
 	int i = 0;
 	char *nnb = (iident(*s) ? s : s + 1), *nb = NULL, *ne = NULL;
 	
-	for (tt = s; ++tt < s + cs - wb;)
+	for (tt = s; ++tt < s + zlecs - wb;)
 	    if (*tt == Inbrack) {
 		i++;
 		nb = nnb;
@@ -1340,23 +1345,23 @@ get_comp_string(void)
 	    int lev;
 	    char *p;
 
-	    for (wb = cs - 1, lev = 0; wb > 0; wb--)
-		if (line[wb] == ']' || line[wb] == ')')
+	    for (wb = zlecs - 1, lev = 0; wb > 0; wb--)
+		if (zleline[wb] == ']' || zleline[wb] == ')')
 		    lev++;
-		else if (line[wb] == '[') {
+		else if (zleline[wb] == '[') {
 		    if (!lev--)
 			break;
-		} else if (line[wb] == '(') {
-		    if (!lev && line[wb - 1] == '(')
+		} else if (zleline[wb] == '(') {
+		    if (!lev && zleline[wb - 1] == '(')
 			break;
 		    if (lev)
 			lev--;
 		}
-	    p = (char *) line + wb;
+	    p = (char *) zleline + wb;
 	    wb++;
 	    if (wb && (*p == '[' || *p == '(') &&
 		!skipparens(*p, (*p == '[' ? ']' : ')'), &p)) {
-		we = (p - (char *) line) - 1;
+		we = (p - (char *) zleline) - 1;
 		if (insubscr == 2)
 		    insubscr = 3;
 	    }
@@ -1364,25 +1369,25 @@ get_comp_string(void)
 	    /* In mathematical expression, we complete parameter names  *
 	     * (even if they don't have a `$' in front of them).  So we *
 	     * have to find that name.                                  */
-	    for (we = cs; iident(line[we]); we++);
-	    for (wb = cs; --wb >= 0 && iident(line[wb]););
+	    for (we = zlecs; iident(zleline[we]); we++);
+	    for (wb = zlecs; --wb >= 0 && iident(zleline[wb]););
 	    wb++;
 	}
 	zsfree(s);
 	s = zalloc(we - wb + 1);
-	strncpy(s, (char *) line + wb, we - wb);
+	strncpy(s, (char *) zleline + wb, we - wb);
 	s[we - wb] = '\0';
-	if (wb > 2 && line[wb - 1] == '[' && iident(line[wb - 2])) {
+	if (wb > 2 && zleline[wb - 1] == '[' && iident(zleline[wb - 2])) {
 	    int i = wb - 3;
-	    unsigned char sav = line[wb - 1];
+	    unsigned char sav = zleline[wb - 1];
 
-	    while (i >= 0 && iident(line[i]))
+	    while (i >= 0 && iident(zleline[i]))
 		i--;
 
-	    line[wb - 1] = '\0';
+	    zleline[wb - 1] = '\0';
 	    zsfree(varname);
-	    varname = ztrdup((char *) line + i + 1);
-	    line[wb - 1] = sav;
+	    varname = ztrdup((char *) zleline + i + 1);
+	    zleline[wb - 1] = sav;
 	    if ((keypm = (Param) paramtab->getnode(paramtab, varname)) &&
 		(keypm->flags & PM_HASHED)) {
 		if (insubscr != 3)
@@ -1393,7 +1398,7 @@ get_comp_string(void)
 	parse_subst_string(s);
     }
     /* This variable will hold the current word in quoted form. */
-    offs = cs - wb;
+    offs = zlecs - wb;
     if ((p = parambeg(s))) {
 	for (p = s; *p; p++)
 	    if (*p == Dnull)
@@ -1437,34 +1442,34 @@ get_comp_string(void)
     /* While building the quoted form, we also clean up the command line. */
     for (p = s, i = wb, j = 0; *p; p++, i++)
 	if (INULL(*p)) {
-	    if (i < cs)
+	    if (i < zlecs)
 		offs--;
 	    if (*p == Snull && isset(RCQUOTES))
 		j = 1-j;
 	    if (p[1] || *p != Bnull) {
 		if (*p == Bnull) {
-		    if (cs == i + 1)
-			cs++, offs++;
+		    if (zlecs == i + 1)
+			zlecs++, offs++;
 		} else {
-		    ocs = cs;
-		    cs = i;
+		    ocs = zlecs;
+		    zlecs = i;
 		    foredel(1);
-		    if ((cs = ocs) > i--)
-			cs--;
+		    if ((zlecs = ocs) > i--)
+			zlecs--;
 		    we--;
 		}
 	    } else {
-		ocs = cs;
-		cs = we;
+		ocs = zlecs;
+		zlecs = we;
 		backdel(1);
 		if (ocs == we)
-		    cs = we - 1;
+		    zlecs = we - 1;
 		else
-		    cs = ocs;
+		    zlecs = ocs;
 		we--;
 	    }
 	    chuck(p--);
-	} else if (j && *p == '\'' && i < cs)
+	} else if (j && *p == '\'' && i < zlecs)
 	    offs--;
 
     zsfree(origword);
@@ -1732,9 +1737,9 @@ inststrlen(char *str, int move, int len)
     if (len == -1)
 	len = strlen(str);
     spaceinline(len);
-    strncpy((char *)(line + cs), str, len);
+    strncpy((char *)(zleline + zlecs), str, len);
     if (move)
-	cs += len;
+	zlecs += len;
     return len;
 }
 
@@ -1787,17 +1792,17 @@ doexpansion(char *s, int lst, int olst, int explincmd)
     if (lst == COMP_LIST_EXPAND) {
 	/* Only the list of expansions was requested. Restore the 
          * command line. */
-        cs = 0;
-        foredel(ll);
+        zlecs = 0;
+        foredel(zlell);
         spaceinline(origll);
-        memcpy(line, origline, origll);
-        cs = origcs;
+        memcpy(zleline, origline, origll);
+        zlecs = origcs;
         ret = listlist(vl);
         showinglist = 0;
 	goto end;
     }
     /* Remove the current word and put the expansions there. */
-    cs = wb;
+    zlecs = wb;
     foredel(we - wb);
     while ((ss = (char *)ugetnode(vl))) {
 	ret = 0;
@@ -1806,11 +1811,11 @@ doexpansion(char *s, int lst, int olst, int explincmd)
 	inststr(ss);
 #if 0
 	if (olst != COMP_EXPAND_COMPLETE || nonempty(vl) ||
-	    (cs && line[cs-1] != '/')) {
+	    (zlecs && zleline[zlecs-1] != '/')) {
 #endif
 	if (nonempty(vl) || !first) {
 	    spaceinline(1);
-	    line[cs++] = ' ';
+	    zleline[zlecs++] = ' ';
 	}
 	first = 0;
     }
@@ -2238,12 +2243,12 @@ doexpandhist(void)
 
     pushheap();
     metafy_line();
-    oll = ll;
-    ocs = cs;
-    ol = (unsigned char *)dupstring((char *)line);
+    oll = zlell;
+    ocs = zlecs;
+    ol = (unsigned char *)dupstring((char *)zleline);
     expanding = 1;
-    excs = cs;
-    ll = cs = 0;
+    excs = zlecs;
+    zlell = zlecs = 0;
     lexsave();
     /* We push ol as it will remain unchanged */
     inpush((char *) ol, 0, NULL);
@@ -2269,8 +2274,8 @@ doexpandhist(void)
     expanding = 0;
 
     if (!err) {
-	cs = excs;
-	if (strcmp((char *)line, (char *)ol)) {
+	zlecs = excs;
+	if (strcmp((char *)zleline, (char *)ol)) {
 	    unmetafy_line();
 	    /* For vi mode -- reset the beginning-of-insertion pointer   *
 	     * to the beginning of the line.  This seems a little silly, *
@@ -2282,9 +2287,9 @@ doexpandhist(void)
 	}
     }
 
-    strcpy((char *)line, (char *)ol);
-    ll = oll;
-    cs = ocs;
+    strcpy((char *)zleline, (char *)ol);
+    zlell = oll;
+    zlecs = ocs;
     unmetafy_line();
 
     popheap();
@@ -2299,10 +2304,12 @@ magicspace(char **args)
     char *bangq;
     int ret;
     lastchar = ' ';
-    for (bangq = (char *)line; (bangq = strchr(bangq, bangchar)); bangq += 2)
-	if (bangq[1] == '"' && (bangq == (char *)line || bangq[-1] != '\\'))
+    for (bangq = (char *)zleline; (bangq = strchr(bangq, bangchar));
+	 bangq += 2)
+	if (bangq[1] == '"' && (bangq == (char *)zleline || bangq[-1] != '\\'))
 	    break;
-    if (!(ret = selfinsert(args)) && (!bangq || bangq + 2 > (char *)line + cs))
+    if (!(ret = selfinsert(args)) &&
+	(!bangq || bangq + 2 > (char *)zleline + zlecs))
 	doexpandhist();
     return ret;
 }
@@ -2328,7 +2335,7 @@ getcurcmd(void)
     zleparse = 2;
     lexsave();
     metafy_line();
-    inpush(dupstrspace((char *) line), 0, NULL);
+    inpush(dupstrspace((char *) zleline), 0, NULL);
     unmetafy_line();
     strinbeg(1);
     pushheap();
@@ -2340,8 +2347,8 @@ getcurcmd(void)
 	if (tok == STRING && curlincmd) {
 	    zsfree(s);
 	    s = ztrdup(tokstr);
-	    cmdwb = ll - wordbeg;
-	    cmdwe = ll + 1 - inbufct;
+	    cmdwb = zlell - wordbeg;
+	    cmdwe = zlell + 1 - inbufct;
 	}
     }
     while (tok != ENDINPUT && tok != LEXERR && zleparse);
@@ -2382,7 +2389,7 @@ processcmd(UNUSED(char **args))
 int
 expandcmdpath(UNUSED(char **args))
 {
-    int oldcs = cs, na = noaliases;
+    int oldcs = zlecs, na = noaliases;
     char *s, *str;
 
     noaliases = 1;
@@ -2394,15 +2401,15 @@ expandcmdpath(UNUSED(char **args))
     zsfree(s);
     if (!str)
 	return 1;
-    cs = cmdwb;
+    zlecs = cmdwb;
     foredel(cmdwe - cmdwb);
     spaceinline(strlen(str));
-    strncpy((char *)line + cs, str, strlen(str));
-    cs = oldcs;
-    if (cs >= cmdwe - 1)
-	cs += cmdwe - cmdwb + strlen(str);
-    if (cs > ll)
-	cs = ll;
+    strncpy((char *)zleline + zlecs, str, strlen(str));
+    zlecs = oldcs;
+    if (zlecs >= cmdwe - 1)
+	zlecs += cmdwe - cmdwb + strlen(str);
+    if (zlecs > zlell)
+	zlecs = zlell;
     return 0;
 }
 
@@ -2417,7 +2424,7 @@ expandorcompleteprefix(char **args)
 
     comppref = 1;
     ret = expandorcomplete(args);
-    if (cs && line[cs - 1] == ' ')
+    if (zlecs && zleline[zlecs - 1] == ' ')
         makesuffixstr(NULL, "\\-", 0);
     comppref = 0;
     return ret;
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 8783e83f9..d1b10c4b0 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -67,9 +67,40 @@ void
 sizeline(int sz)
 {
     while (sz > linesz)
-	line = (unsigned char *)realloc(line, (linesz *= 4) + 2);
+	zleline = (unsigned char *)realloc(zleline, (linesz *= 4) + 2);
 }
 
+/*
+ * Insert a character, called from main shell.
+ *
+ * WCHAR: type is wrong, should be a genuine wide character,
+ * when available in the caller.
+ */
+
+/**/
+mod_export void
+zleaddtoline(int chr)
+{
+    spaceinline(1);
+    zleline[zlecs++] = chr;
+}
+
+/*
+    return zleline;
+    return zleline;
+ */
+
+/**/
+mod_export unsigned char *
+zlegetline(int *ll, int *cs)
+{
+    *ll = zlell;
+    *cs = zlecs;
+
+    return zleline;
+}
+
+
 /* insert space for ct chars at cursor position */
 
 /**/
@@ -78,13 +109,13 @@ spaceinline(int ct)
 {
     int i;
 
-    sizeline(ct + ll);
-    for (i = ll; --i >= cs;)
-	line[i + ct] = line[i];
-    ll += ct;
-    line[ll] = '\0';
+    sizeline(ct + zlell);
+    for (i = zlell; --i >= zlecs;)
+	zleline[i + ct] = zleline[i];
+    zlell += ct;
+    zleline[zlell] = '\0';
 
-    if (mark > cs)
+    if (mark > zlecs)
 	mark += ct;
 }
 
@@ -97,18 +128,18 @@ shiftchars(int to, int cnt)
     else if (mark > to)
 	mark = to;
 
-    while (to + cnt < ll) {
-	line[to] = line[to + cnt];
+    while (to + cnt < zlell) {
+	zleline[to] = zleline[to + cnt];
 	to++;
     }
-    line[ll = to] = '\0';
+    zleline[zlell = to] = '\0';
 }
 
 /**/
 mod_export void
 backkill(int ct, int dir)
 {
-    int i = (cs -= ct);
+    int i = (zlecs -= ct);
 
     cut(i, ct, dir);
     shiftchars(i, ct);
@@ -118,7 +149,7 @@ backkill(int ct, int dir)
 mod_export void
 forekill(int ct, int dir)
 {
-    int i = cs;
+    int i = zlecs;
 
     cut(i, ct, dir);
     shiftchars(i, ct);
@@ -137,7 +168,7 @@ cut(int i, int ct, int dir)
 	if (!(zmod.flags & MOD_VIAPP) || !b->buf) {
 	    zfree(b->buf, b->len);
 	    b->buf = (char *)zalloc(ct);
-	    memcpy(b->buf, (char *) line + i, ct);
+	    memcpy(b->buf, (char *) zleline + i, ct);
 	    b->len = ct;
 	    b->flags = vilinerange ? CUTBUFFER_LINE : 0;
 	} else {
@@ -148,7 +179,7 @@ cut(int i, int ct, int dir)
 	    b->buf = realloc(b->buf, ct + len + !!(b->flags & CUTBUFFER_LINE));
 	    if (b->flags & CUTBUFFER_LINE)
 		b->buf[len++] = '\n';
-	    memcpy(b->buf + len, (char *) line + i, ct);
+	    memcpy(b->buf + len, (char *) zleline + i, ct);
 	    b->len = len + ct;
 	}
 	return;
@@ -159,7 +190,7 @@ cut(int i, int ct, int dir)
 	for(n=34; n>26; n--)
 	    vibuf[n] = vibuf[n-1];
 	vibuf[26].buf = (char *)zalloc(ct);
-	memcpy(vibuf[26].buf, (char *) line + i, ct);
+	memcpy(vibuf[26].buf, (char *) zleline + i, ct);
 	vibuf[26].len = ct;
 	vibuf[26].flags = vilinerange ? CUTBUFFER_LINE : 0;
     }
@@ -183,14 +214,14 @@ cut(int i, int ct, int dir)
     if (dir) {
 	char *s = (char *)zalloc(cutbuf.len + ct);
 
-	memcpy(s, (char *) line + i, ct);
+	memcpy(s, (char *) zleline + i, ct);
 	memcpy(s + ct, cutbuf.buf, cutbuf.len);
 	free(cutbuf.buf);
 	cutbuf.buf = s;
 	cutbuf.len += ct;
     } else {
 	cutbuf.buf = realloc(cutbuf.buf, cutbuf.len + ct);
-	memcpy(cutbuf.buf + cutbuf.len, (char *) line + i, ct);
+	memcpy(cutbuf.buf + cutbuf.len, (char *) zleline + i, ct);
 	cutbuf.len += ct;
     }
     if(vilinerange)
@@ -203,14 +234,14 @@ cut(int i, int ct, int dir)
 mod_export void
 backdel(int ct)
 {
-    shiftchars(cs -= ct, ct);
+    shiftchars(zlecs -= ct, ct);
 }
 
 /**/
 mod_export void
 foredel(int ct)
 {
-    shiftchars(cs, ct);
+    shiftchars(zlecs, ct);
 }
 
 /**/
@@ -218,19 +249,19 @@ void
 setline(char const *s)
 {
     sizeline(strlen(s));
-    strcpy((char *) line, s);
-    unmetafy((char *) line, &ll);
-    if ((cs = ll) && invicmdmode())
-	cs--;
+    strcpy((char *) zleline, s);
+    unmetafy((char *) zleline, &zlell);
+    if ((zlecs = zlell) && invicmdmode())
+	zlecs--;
 }
 
 /**/
 int
 findbol(void)
 {
-    int x = cs;
+    int x = zlecs;
 
-    while (x > 0 && line[x - 1] != '\n')
+    while (x > 0 && zleline[x - 1] != '\n')
 	x--;
     return x;
 }
@@ -239,9 +270,9 @@ findbol(void)
 int
 findeol(void)
 {
-    int x = cs;
+    int x = zlecs;
 
-    while (x != ll && line[x] != '\n')
+    while (x != zlell && zleline[x] != '\n')
 	x++;
     return x;
 }
@@ -451,8 +482,8 @@ initundo(void)
     curchange->prev = curchange->next = NULL;
     curchange->del = curchange->ins = NULL;
     lastline = zalloc(lastlinesz = linesz);
-    memcpy(lastline, line, lastll = ll);
-    lastcs = cs;
+    memcpy(lastline, zleline, lastll = zlell);
+    lastcs = zlecs;
 }
 
 /**/
@@ -512,30 +543,30 @@ void
 mkundoent(void)
 {
     int pre, suf;
-    int sh = ll < lastll ? ll : lastll;
+    int sh = zlell < lastll ? zlell : lastll;
     struct change *ch;
 
-    if(lastll == ll && !memcmp(lastline, line, ll))
+    if(lastll == zlell && !memcmp(lastline, zleline, zlell))
 	return;
-    for(pre = 0; pre < sh && line[pre] == lastline[pre]; )
+    for(pre = 0; pre < sh && zleline[pre] == lastline[pre]; )
 	pre++;
     for(suf = 0; suf < sh - pre &&
-	line[ll - 1 - suf] == lastline[lastll - 1 - suf]; )
+	zleline[zlell - 1 - suf] == lastline[lastll - 1 - suf]; )
 	suf++;
     ch = zalloc(sizeof(*ch));
     ch->next = NULL;
     ch->hist = histline;
     ch->off = pre;
     ch->old_cs = lastcs;
-    ch->new_cs = cs;
+    ch->new_cs = zlecs;
     if(suf + pre == lastll)
 	ch->del = NULL;
     else
 	ch->del = metafy(lastline + pre, lastll - pre - suf, META_DUP);
-    if(suf + pre == ll)
+    if(suf + pre == zlell)
 	ch->ins = NULL;
     else
-	ch->ins = metafy((char *)line + pre, ll - pre - suf, META_DUP);
+	ch->ins = metafy((char *)zleline + pre, zlell - pre - suf, META_DUP);
     if(nextchanges) {
 	ch->flags = CH_PREV;
 	ch->prev = endnextchanges;
@@ -557,8 +588,8 @@ setlastline(void)
 {
     if(lastlinesz != linesz)
 	lastline = realloc(lastline, lastlinesz = linesz);
-    memcpy(lastline, line, lastll = ll);
-    lastcs = cs;
+    memcpy(lastline, zleline, lastll = zlell);
+    lastcs = zlecs;
 }
 
 /* move backwards through the change list */
@@ -586,10 +617,10 @@ unapplychange(struct change *ch)
 {
     if(ch->hist != histline) {
 	zle_setline(quietgethist(ch->hist));
-	cs = ch->new_cs;
+	zlecs = ch->new_cs;
 	return 0;
     }
-    cs = ch->off;
+    zlecs = ch->off;
     if(ch->ins)
 	foredel(ztrlen(ch->ins));
     if(ch->del) {
@@ -598,11 +629,11 @@ unapplychange(struct change *ch)
 	spaceinline(ztrlen(c));
 	for(; *c; c++)
 	    if(*c == Meta)
-		line[cs++] = STOUC(*++c) ^ 32;
+		zleline[zlecs++] = STOUC(*++c) ^ 32;
 	    else
-		line[cs++] = STOUC(*c);
+		zleline[zlecs++] = STOUC(*c);
     }
-    cs = ch->old_cs;
+    zlecs = ch->old_cs;
     return 1;
 }
 
@@ -631,10 +662,10 @@ applychange(struct change *ch)
 {
     if(ch->hist != histline) {
 	zle_setline(quietgethist(ch->hist));
-	cs = ch->old_cs;
+	zlecs = ch->old_cs;
 	return 0;
     }
-    cs = ch->off;
+    zlecs = ch->off;
     if(ch->del)
 	foredel(ztrlen(ch->del));
     if(ch->ins) {
@@ -643,11 +674,11 @@ applychange(struct change *ch)
 	spaceinline(ztrlen(c));
 	for(; *c; c++)
 	    if(*c == Meta)
-		line[cs++] = STOUC(*++c) ^ 32;
+		zleline[zlecs++] = STOUC(*++c) ^ 32;
 	    else
-		line[cs++] = STOUC(*c);
+		zleline[zlecs++] = STOUC(*c);
     }
-    cs = ch->new_cs;
+    zlecs = ch->new_cs;
     return 1;
 }
 
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 81a095c71..15a2deb49 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -91,7 +91,7 @@ startvitext(int im)
     startvichange(im);
     selectkeymap("main", 1);
     undoing = 0;
-    viinsbegin = cs;
+    viinsbegin = zlecs;
 }
 
 /**/
@@ -118,12 +118,12 @@ vigetkey(void)
 	if ((lastchar = getkey(0)) == EOF)
 	    return -1;
     } else if(cmd == Th(z_viquotedinsert)) {
-	char sav = line[cs];
+	char sav = zleline[zlecs];
 
-	line[cs] = '^';
+	zleline[zlecs] = '^';
 	zrefresh();
 	lastchar = getkey(0);
-	line[cs] = sav;
+	zleline[zlecs] = sav;
 	if(lastchar == EOF)
 	    return -1;
     } else if (cmd == Th(z_vicmdmode))
@@ -135,7 +135,7 @@ vigetkey(void)
 static int
 getvirange(int wf)
 {
-    int pos = cs, ret = 0;
+    int pos = zlecs, ret = 0;
     int mult1 = zmult, hist1 = histline;
     Thingy k2;
 
@@ -181,16 +181,16 @@ getvirange(int wf)
     /* It is an error to use a non-movement command to delimit the *
      * range.  We here reject the case where the command modified  *
      * the line, or selected a different history line.             */
-    if (histline != hist1 || ll != lastll || memcmp(line, lastline, ll)) {
+    if (histline != hist1 || zlell != lastll || memcmp(zleline, lastline, zlell)) {
 	histline = hist1;
-	memcpy(line, lastline, ll = lastll);
-	cs = pos;
+	memcpy(zleline, lastline, zlell = lastll);
+	zlecs = pos;
 	return -1;
     }
 
     /* Can't handle an empty file.  Also, if the movement command *
      * failed, or didn't move, it is an error.                    */
-    if (!ll || (cs == pos && virangeflag != 2) || ret == -1)
+    if (!zlell || (zlecs == pos && virangeflag != 2) || ret == -1)
 	return -1;
 
     /* vi-match-bracket changes the value of virangeflag when *
@@ -199,26 +199,26 @@ getvirange(int wf)
     if(virangeflag == -1)
 	pos++;
 
-    /* Get the range the right way round.  cs is placed at the *
+    /* Get the range the right way round.  zlecs is placed at the *
      * start of the range, and pos (the return value of this   *
      * function) is the end.                                   */
-    if (cs > pos) {
-	int tmp = cs;
-	cs = pos;
+    if (zlecs > pos) {
+	int tmp = zlecs;
+	zlecs = pos;
 	pos = tmp;
     }
 
     /* Was it a line-oriented move?  If so, the command will have set *
      * the vilinerange flag.  In this case, entire lines are taken,   *
      * rather than just the sequence of characters delimited by pos   *
-     * and cs.  The terminating newline is left out of the range,     *
+     * and zlecs.  The terminating newline is left out of the range,     *
      * which the real command must deal with appropriately.  At this  *
      * point we just need to make the range encompass entire lines.   */
     if(vilinerange) {
 	int newcs = findbol();
-	cs = pos;
+	zlecs = pos;
 	pos = findeol();
-	cs = newcs;
+	zlecs = newcs;
     }
     return pos;
 }
@@ -227,7 +227,7 @@ getvirange(int wf)
 static int
 dovilinerange(void)
 {
-    int pos = cs, n = zmult;
+    int pos = zlecs, n = zmult;
 
     /* A number of lines is taken as the range.  The current line *
      * is included.  If the repeat count is positive the lines go *
@@ -237,21 +237,21 @@ dovilinerange(void)
     if (!n)
 	return 1;
     if (n > 0) {
-	while(n-- && cs <= ll)
-	    cs = findeol() + 1;
+	while(n-- && zlecs <= zlell)
+	    zlecs = findeol() + 1;
 	if (n != -1) {
-	    cs = pos;
+	    zlecs = pos;
 	    return 1;
 	}
-	cs--;
+	zlecs--;
     } else {
-	while(n++ && cs >= 0)
-	    cs = findbol() - 1;
+	while(n++ && zlecs >= 0)
+	    zlecs = findbol() - 1;
 	if (n != 1) {
-	    cs = pos;
+	    zlecs = pos;
 	    return 1;
 	}
-	cs++;
+	zlecs++;
     }
     virangeflag = 2;
     return 0;
@@ -261,8 +261,8 @@ dovilinerange(void)
 int
 viaddnext(UNUSED(char **args))
 {
-    if (cs != findeol())
-	cs++;
+    if (zlecs != findeol())
+	zlecs++;
     startvitext(1);
     return 0;
 }
@@ -271,7 +271,7 @@ viaddnext(UNUSED(char **args))
 int
 viaddeol(UNUSED(char **args))
 {
-    cs = findeol();
+    zlecs = findeol();
     startvitext(1);
     return 0;
 }
@@ -301,11 +301,11 @@ videlete(UNUSED(char **args))
 
     startvichange(1);
     if ((c2 = getvirange(0)) != -1) {
-	forekill(c2 - cs, 0);
+	forekill(c2 - zlecs, 0);
 	ret = 0;
-	if (vilinerange && ll) {
-	    if (cs == ll)
-		cs--;
+	if (vilinerange && zlell) {
+	    if (zlecs == zlell)
+		zlecs--;
 	    foredel(1);
 	    vifirstnonblank(zlenoargs);
 	}
@@ -330,12 +330,12 @@ videletechar(char **args)
 	return ret;
     }
     /* it is an error to be on the end of line */
-    if (cs == ll || line[cs] == '\n')
+    if (zlecs == zlell || zleline[zlecs] == '\n')
 	return 1;
     /* Put argument into the acceptable range -- it is not an error to  *
      * specify a greater count than the number of available characters. */
-    if (n > findeol() - cs)
-	n = findeol() - cs;
+    if (n > findeol() - zlecs)
+	n = findeol() - zlecs;
     /* do the deletion */
     forekill(n, 0);
     return 0;
@@ -350,9 +350,9 @@ vichange(UNUSED(char **args))
     startvichange(1);
     if ((c2 = getvirange(1)) != -1) {
 	ret = 0;
-	forekill(c2 - cs, 0);
+	forekill(c2 - zlecs, 0);
 	selectkeymap("main", 1);
-	viinsbegin = cs;
+	viinsbegin = zlecs;
 	undoing = 0;
     }
     return ret;
@@ -368,12 +368,12 @@ visubstitute(UNUSED(char **args))
     if (n < 0)
 	return 1;
     /* it is an error to be on the end of line */
-    if (cs == ll || line[cs] == '\n')
+    if (zlecs == zlell || zleline[zlecs] == '\n')
 	return 1;
     /* Put argument into the acceptable range -- it is not an error to  *
      * specify a greater count than the number of available characters. */
-    if (n > findeol() - cs)
-	n = findeol() - cs;
+    if (n > findeol() - zlecs)
+	n = findeol() - zlecs;
     /* do the substitution */
     forekill(n, 0);
     startvitext(1);
@@ -384,7 +384,7 @@ visubstitute(UNUSED(char **args))
 int
 vichangeeol(UNUSED(char **args))
 {
-    forekill(findeol() - cs, 0);
+    forekill(findeol() - zlecs, 0);
     startvitext(1);
     return 0;
 }
@@ -401,15 +401,15 @@ vichangewholeline(char **args)
 int
 viyank(UNUSED(char **args))
 {
-    int oldcs = cs, c2, ret = 1;
+    int oldcs = zlecs, c2, ret = 1;
 
     startvichange(1);
     if ((c2 = getvirange(0)) != -1) {
-	cut(cs, c2 - cs, 0);
+	cut(zlecs, c2 - zlecs, 0);
 	ret = 0;
     }
     vichgflag = 0;
-    cs = oldcs;
+    zlecs = oldcs;
     return ret;
 }
 
@@ -420,9 +420,9 @@ viyankeol(UNUSED(char **args))
     int x = findeol();
 
     startvichange(-1);
-    if (x == cs)
+    if (x == zlecs)
 	return 1;
-    cut(cs, x - cs, 0);
+    cut(zlecs, x - zlecs, 0);
     return 0;
 }
 
@@ -430,22 +430,22 @@ viyankeol(UNUSED(char **args))
 int
 viyankwholeline(UNUSED(char **args))
 {
-    int bol = findbol(), oldcs = cs;
+    int bol = findbol(), oldcs = zlecs;
     int n = zmult;
 
     startvichange(-1);
     if (n < 1)
 	return 1;
     while(n--) {
-     if (cs > ll) {
-	cs = oldcs;
+     if (zlecs > zlell) {
+	zlecs = oldcs;
 	return 1;
      }
-     cs = findeol() + 1;
+     zlecs = findeol() + 1;
     }
     vilinerange = 1;
-    cut(bol, cs - bol - 1, 0);
-    cs = oldcs;
+    cut(bol, zlecs - bol - 1, 0);
+    zlecs = oldcs;
     return 0;
 }
 
@@ -478,7 +478,7 @@ vireplacechars(UNUSED(char **args))
 
     startvichange(1);
     /* check argument range */
-    if (n < 1 || n + cs > findeol()) {
+    if (n < 1 || n + zlecs > findeol()) {
 	if(vichgrepeat)
 	    vigetkey();
 	if(vichgflag) {
@@ -496,13 +496,13 @@ vireplacechars(UNUSED(char **args))
     /* do change */
     if (ch == '\r' || ch == '\n') {
 	/* <return> handled specially */
-	cs += n - 1;
+	zlecs += n - 1;
 	backkill(n - 1, 0);
-	line[cs++] = '\n';
+	zleline[zlecs++] = '\n';
     } else {
 	while (n--)
-	    line[cs++] = ch;
-	cs--;
+	    zleline[zlecs++] = ch;
+	zlecs--;
     }
     vichgflag = 0;
     return 0;
@@ -516,8 +516,8 @@ vicmdmode(UNUSED(char **args))
 	return 1;
     undoing = 1;
     vichgflag = 0;
-    if (cs != findbol())
-	cs--;
+    if (zlecs != findbol())
+	zlecs--;
     return 0;
 }
 
@@ -525,9 +525,9 @@ vicmdmode(UNUSED(char **args))
 int
 viopenlinebelow(UNUSED(char **args))
 {
-    cs = findeol();
+    zlecs = findeol();
     spaceinline(1);
-    line[cs++] = '\n';
+    zleline[zlecs++] = '\n';
     startvitext(1);
     clearlist = 1;
     return 0;
@@ -537,9 +537,9 @@ viopenlinebelow(UNUSED(char **args))
 int
 viopenlineabove(UNUSED(char **args))
 {
-    cs = findbol();
+    zlecs = findbol();
     spaceinline(1);
-    line[cs] = '\n';
+    zleline[zlecs] = '\n';
     startvitext(1);
     clearlist = 1;
     return 0;
@@ -554,17 +554,17 @@ vioperswapcase(UNUSED(char **args))
     /* get the range */
     startvichange(1);
     if ((c2 = getvirange(0)) != -1) {
-	oldcs = cs;
+	oldcs = zlecs;
 	/* swap the case of all letters within range */
-	while (cs < c2) {
-	    if (islower(line[cs]))
-		line[cs] = tuupper(line[cs]);
-	    else if (isupper(line[cs]))
-		line[cs] = tulower(line[cs]);
-	    cs++;
+	while (zlecs < c2) {
+	    if (islower(zleline[zlecs]))
+		zleline[zlecs] = tuupper(zleline[zlecs]);
+	    else if (isupper(zleline[zlecs]))
+		zleline[zlecs] = tulower(zleline[zlecs]);
+	    zlecs++;
 	}
 	/* go back to the first line of the range */
-	cs = oldcs;
+	zlecs = oldcs;
 	ret = 0;
 #if 0
 	vifirstnonblank();
@@ -601,7 +601,7 @@ virepeatchange(UNUSED(char **args))
 int
 viindent(UNUSED(char **args))
 {
-    int oldcs = cs, c2;
+    int oldcs = zlecs, c2;
 
     /* get the range */
     startvichange(1);
@@ -612,18 +612,18 @@ viindent(UNUSED(char **args))
     vichgflag = 0;
     /* must be a line range */
     if (!vilinerange) {
-	cs = oldcs;
+	zlecs = oldcs;
 	return 1;
     }
-    oldcs = cs;
+    oldcs = zlecs;
     /* add a tab to the beginning of each line within range */
-    while (cs < c2) {
+    while (zlecs < c2) {
 	spaceinline(1);
-	line[cs] = '\t';
-	cs = findeol() + 1;
+	zleline[zlecs] = '\t';
+	zlecs = findeol() + 1;
     }
     /* go back to the first line of the range */
-    cs = oldcs;
+    zlecs = oldcs;
     vifirstnonblank(zlenoargs);
     return 0;
 }
@@ -632,7 +632,7 @@ viindent(UNUSED(char **args))
 int
 viunindent(UNUSED(char **args))
 {
-    int oldcs = cs, c2;
+    int oldcs = zlecs, c2;
 
     /* get the range */
     startvichange(1);
@@ -643,18 +643,18 @@ viunindent(UNUSED(char **args))
     vichgflag = 0;
     /* must be a line range */
     if (!vilinerange) {
-	cs = oldcs;
+	zlecs = oldcs;
 	return 1;
     }
-    oldcs = cs;
+    oldcs = zlecs;
     /* remove a tab from the beginning of each line within range */
-    while (cs < c2) {
-	if (line[cs] == '\t')
+    while (zlecs < c2) {
+	if (zleline[zlecs] == '\t')
 	    foredel(1);
-	cs = findeol() + 1;
+	zlecs = findeol() + 1;
     }
     /* go back to the first line of the range */
-    cs = oldcs;
+    zlecs = oldcs;
     vifirstnonblank(zlenoargs);
     return 0;
 }
@@ -677,13 +677,13 @@ vibackwarddeletechar(char **args)
     }
     /* It is an error to be at the beginning of the line, or (in *
      * insert mode) to delete past the beginning of insertion.   */
-    if ((!invicmdmode() && cs - n < viinsbegin) || cs == findbol()) {
+    if ((!invicmdmode() && zlecs - n < viinsbegin) || zlecs == findbol()) {
 	return 1;
     }
     /* Put argument into the acceptable range -- it is not an error to  *
      * specify a greater count than the number of available characters. */
-    if (n > cs - findbol())
-	n = cs - findbol();
+    if (n > zlecs - findbol())
+	n = zlecs - findbol();
     /* do the deletion */
     backkill(n, 1);
     return 0;
@@ -693,9 +693,9 @@ vibackwarddeletechar(char **args)
 int
 vikillline(UNUSED(char **args))
 {
-    if (viinsbegin > cs)
+    if (viinsbegin > zlecs)
 	return 1;
-    backdel(cs - viinsbegin);
+    backdel(zlecs - viinsbegin);
     return 0;
 }
 
@@ -714,19 +714,19 @@ viputbefore(UNUSED(char **args))
     if (!buf->buf)
 	return 1;
     if(buf->flags & CUTBUFFER_LINE) {
-	cs = findbol();
+	zlecs = findbol();
 	spaceinline(buf->len + 1);
-	memcpy((char *)line + cs, buf->buf, buf->len);
-	line[cs + buf->len] = '\n';
+	memcpy((char *)zleline + zlecs, buf->buf, buf->len);
+	zleline[zlecs + buf->len] = '\n';
 	vifirstnonblank(zlenoargs);
     } else {
 	while (n--) {
 	    spaceinline(buf->len);
-	    memcpy((char *)line + cs, buf->buf, buf->len);
-	    cs += buf->len;
+	    memcpy((char *)zleline + zlecs, buf->buf, buf->len);
+	    zlecs += buf->len;
 	}
-	if (cs)
-	    cs--;
+	if (zlecs)
+	    zlecs--;
     }
     return 0;
 }
@@ -746,21 +746,21 @@ viputafter(UNUSED(char **args))
     if (!buf->buf)
 	return 1;
     if(buf->flags & CUTBUFFER_LINE) {
-	cs = findeol();
+	zlecs = findeol();
 	spaceinline(buf->len + 1);
-	line[cs++] = '\n';
-	memcpy((char *)line + cs, buf->buf, buf->len);
+	zleline[zlecs++] = '\n';
+	memcpy((char *)zleline + zlecs, buf->buf, buf->len);
 	vifirstnonblank(zlenoargs);
     } else {
-	if (cs != findeol())
-	    cs++;
+	if (zlecs != findeol())
+	    zlecs++;
 	while (n--) {
 	    spaceinline(buf->len);
-	    memcpy((char *)line + cs, buf->buf, buf->len);
-	    cs += buf->len;
+	    memcpy((char *)zleline + zlecs, buf->buf, buf->len);
+	    zlecs += buf->len;
 	}
-	if (cs)
-	    cs--;
+	if (zlecs)
+	    zlecs--;
     }
     return 0;
 }
@@ -772,16 +772,16 @@ vijoin(UNUSED(char **args))
     int x;
 
     startvichange(-1);
-    if ((x = findeol()) == ll)
+    if ((x = findeol()) == zlell)
 	return 1;
-    cs = x + 1;
-    for (x = 1; cs != ll && iblank(line[cs]); cs++, x++);
+    zlecs = x + 1;
+    for (x = 1; zlecs != zlell && iblank(zleline[zlecs]); zlecs++, x++);
     backdel(x);
-    if (cs && iblank(line[cs-1]))
-	cs--;
+    if (zlecs && iblank(zleline[zlecs-1]))
+	zlecs--;
     else {
 	spaceinline(1);
-	line[cs] = ' ';
+	zleline[zlecs] = ' ';
     }
     return 0;
 }
@@ -796,15 +796,15 @@ viswapcase(UNUSED(char **args))
     if (n < 1)
 	return 1;
     eol = findeol();
-    while (cs < eol && n--) {
-	if (islower(line[cs]))
-	    line[cs] = tuupper(line[cs]);
-	else if (isupper(line[cs]))
-	    line[cs] = tulower(line[cs]);
-	cs++;
-    }
-    if (cs && cs == eol)
-	cs--;
+    while (zlecs < eol && n--) {
+	if (islower(zleline[zlecs]))
+	    zleline[zlecs] = tuupper(zleline[zlecs]);
+	else if (isupper(zleline[zlecs]))
+	    zleline[zlecs] = tulower(zleline[zlecs]);
+	zlecs++;
+    }
+    if (zlecs && zlecs == eol)
+	zlecs--;
     return 0;
 }
 
@@ -846,7 +846,7 @@ visetbuffer(UNUSED(char **args))
 int
 vikilleol(UNUSED(char **args))
 {
-    int n = findeol() - cs;
+    int n = findeol() - zlecs;
 
     startvichange(-1);
     if (!n) {
@@ -854,7 +854,7 @@ vikilleol(UNUSED(char **args))
 	return 1;
     }
     /* delete to end of line */
-    forekill(findeol() - cs, 0);
+    forekill(findeol() - zlecs, 0);
     return 0;
 }
 
@@ -862,21 +862,21 @@ vikilleol(UNUSED(char **args))
 int
 vipoundinsert(UNUSED(char **args))
 {
-    int oldcs = cs;
+    int oldcs = zlecs;
 
     startvichange(-1);
     vifirstnonblank(zlenoargs);
-    if(line[cs] != '#') {
+    if(zleline[zlecs] != '#') {
 	spaceinline(1);
-	line[cs] = '#';
-	if(cs <= viinsbegin)
+	zleline[zlecs] = '#';
+	if(zlecs <= viinsbegin)
 	    viinsbegin++;
-	cs = oldcs + (cs <= oldcs);
+	zlecs = oldcs + (zlecs <= oldcs);
     } else {
 	foredel(1);
-	if (cs < viinsbegin)
+	if (zlecs < viinsbegin)
 	    viinsbegin--;
-	cs = oldcs - (cs < oldcs);
+	zlecs = oldcs - (zlecs < oldcs);
     }
     return 0;
 }
@@ -890,7 +890,7 @@ viquotedinsert(char **args)
 #endif
 
     spaceinline(1);
-    line[cs] = '^';
+    zleline[zlecs] = '^';
     zrefresh();
 #ifndef HAS_TIO
     sob = shttyinfo.sgttyb;
diff --git a/Src/Zle/zle_word.c b/Src/Zle/zle_word.c
index 5c096e5d3..ea8d31bc5 100644
--- a/Src/Zle/zle_word.c
+++ b/Src/Zle/zle_word.c
@@ -44,12 +44,12 @@ forwardword(char **args)
 	return ret;
     }
     while (n--) {
-	while (cs != ll && iword(line[cs]))
-	    cs++;
+	while (zlecs != zlell && iword(zleline[zlecs]))
+	    zlecs++;
 	if (wordflag && !n)
 	    return 0;
-	while (cs != ll && !iword(line[cs]))
-	    cs++;
+	while (zlecs != zlell && !iword(zleline[zlecs]))
+	    zlecs++;
     }
     return 0;
 }
@@ -68,16 +68,16 @@ viforwardword(char **args)
 	return ret;
     }
     while (n--) {
-	if (iident(line[cs]))
-	    while (cs != ll && iident(line[cs]))
-		cs++;
+	if (iident(zleline[zlecs]))
+	    while (zlecs != zlell && iident(zleline[zlecs]))
+		zlecs++;
 	else
-	    while (cs != ll && !iident(line[cs]) && !iblank(line[cs]))
-		cs++;
+	    while (zlecs != zlell && !iident(zleline[zlecs]) && !iblank(zleline[zlecs]))
+		zlecs++;
 	if (wordflag && !n)
 	    return 0;
-	while (cs != ll && (iblank(line[cs]) || line[cs] == '\n'))
-	    cs++;
+	while (zlecs != zlell && (iblank(zleline[zlecs]) || zleline[zlecs] == '\n'))
+	    zlecs++;
     }
     return 0;
 }
@@ -96,12 +96,12 @@ viforwardblankword(char **args)
 	return ret;
     }
     while (n--) {
-	while (cs != ll && !iblank(line[cs]))
-	    cs++;
+	while (zlecs != zlell && !iblank(zleline[zlecs]))
+	    zlecs++;
 	if (wordflag && !n)
 	    return 0;
-	while (cs != ll && iblank(line[cs]))
-	    cs++;
+	while (zlecs != zlell && iblank(zleline[zlecs]))
+	    zlecs++;
     }
     return 0;
 }
@@ -120,12 +120,12 @@ emacsforwardword(char **args)
 	return ret;
     }
     while (n--) {
-	while (cs != ll && !iword(line[cs]))
-	    cs++;
+	while (zlecs != zlell && !iword(zleline[zlecs]))
+	    zlecs++;
 	if (wordflag && !n)
 	    return 0;
-	while (cs != ll && iword(line[cs]))
-	    cs++;
+	while (zlecs != zlell && iword(zleline[zlecs]))
+	    zlecs++;
     }
     return 0;
 }
@@ -139,13 +139,13 @@ viforwardblankwordend(UNUSED(char **args))
     if (n < 0)
 	return 1;
     while (n--) {
-	while (cs != ll && iblank(line[cs + 1]))
-	    cs++;
-	while (cs != ll && !iblank(line[cs + 1]))
-	    cs++;
+	while (zlecs != zlell && iblank(zleline[zlecs + 1]))
+	    zlecs++;
+	while (zlecs != zlell && !iblank(zleline[zlecs + 1]))
+	    zlecs++;
     }
-    if (cs != ll && virangeflag)
-	cs++;
+    if (zlecs != zlell && virangeflag)
+	zlecs++;
     return 0;
 }
 
@@ -163,18 +163,18 @@ viforwardwordend(char **args)
 	return ret;
     }
     while (n--) {
-	if (iblank(line[cs + 1]))
-	    while (cs != ll && iblank(line[cs + 1]))
-		cs++;
-	if (iident(line[cs + 1]))
-	    while (cs != ll && iident(line[cs + 1]))
-		cs++;
+	if (iblank(zleline[zlecs + 1]))
+	    while (zlecs != zlell && iblank(zleline[zlecs + 1]))
+		zlecs++;
+	if (iident(zleline[zlecs + 1]))
+	    while (zlecs != zlell && iident(zleline[zlecs + 1]))
+		zlecs++;
 	else
-	    while (cs != ll && !iident(line[cs + 1]) && !iblank(line[cs + 1]))
-		cs++;
+	    while (zlecs != zlell && !iident(zleline[zlecs + 1]) && !iblank(zleline[zlecs + 1]))
+		zlecs++;
     }
-    if (cs != ll && virangeflag)
-	cs++;
+    if (zlecs != zlell && virangeflag)
+	zlecs++;
     return 0;
 }
 
@@ -192,10 +192,10 @@ backwardword(char **args)
 	return ret;
     }
     while (n--) {
-	while (cs && !iword(line[cs - 1]))
-	    cs--;
-	while (cs && iword(line[cs - 1]))
-	    cs--;
+	while (zlecs && !iword(zleline[zlecs - 1]))
+	    zlecs--;
+	while (zlecs && iword(zleline[zlecs - 1]))
+	    zlecs--;
     }
     return 0;
 }
@@ -214,14 +214,14 @@ vibackwardword(char **args)
 	return ret;
     }
     while (n--) {
-	while (cs && iblank(line[cs - 1]))
-	    cs--;
-	if (iident(line[cs - 1]))
-	    while (cs && iident(line[cs - 1]))
-		cs--;
+	while (zlecs && iblank(zleline[zlecs - 1]))
+	    zlecs--;
+	if (iident(zleline[zlecs - 1]))
+	    while (zlecs && iident(zleline[zlecs - 1]))
+		zlecs--;
 	else
-	    while (cs && !iident(line[cs - 1]) && !iblank(line[cs - 1]))
-		cs--;
+	    while (zlecs && !iident(zleline[zlecs - 1]) && !iblank(zleline[zlecs - 1]))
+		zlecs--;
     }
     return 0;
 }
@@ -240,10 +240,10 @@ vibackwardblankword(char **args)
 	return ret;
     }
     while (n--) {
-	while (cs && iblank(line[cs - 1]))
-	    cs--;
-	while (cs && !iblank(line[cs - 1]))
-	    cs--;
+	while (zlecs && iblank(zleline[zlecs - 1]))
+	    zlecs--;
+	while (zlecs && !iblank(zleline[zlecs - 1]))
+	    zlecs--;
     }
     return 0;
 }
@@ -262,10 +262,10 @@ emacsbackwardword(char **args)
 	return ret;
     }
     while (n--) {
-	while (cs && !iword(line[cs - 1]))
-	    cs--;
-	while (cs && iword(line[cs - 1]))
-	    cs--;
+	while (zlecs && !iword(zleline[zlecs - 1]))
+	    zlecs--;
+	while (zlecs && iword(zleline[zlecs - 1]))
+	    zlecs--;
     }
     return 0;
 }
@@ -274,7 +274,7 @@ emacsbackwardword(char **args)
 int
 backwarddeleteword(char **args)
 {
-    int x = cs, n = zmult;
+    int x = zlecs, n = zmult;
 
     if (n < 0) {
 	int ret;
@@ -284,12 +284,12 @@ backwarddeleteword(char **args)
 	return ret;
     }
     while (n--) {
-	while (x && !iword(line[x - 1]))
+	while (x && !iword(zleline[x - 1]))
 	    x--;
-	while (x && iword(line[x - 1]))
+	while (x && iword(zleline[x - 1]))
 	    x--;
     }
-    backdel(cs - x);
+    backdel(zlecs - x);
     return 0;
 }
 
@@ -297,23 +297,23 @@ backwarddeleteword(char **args)
 int
 vibackwardkillword(UNUSED(char **args))
 {
-    int x = cs, lim = (viinsbegin > findbol()) ? viinsbegin : findbol();
+    int x = zlecs, lim = (viinsbegin > findbol()) ? viinsbegin : findbol();
     int n = zmult;
 
     if (n < 0)
 	return 1;
 /* this taken from "vibackwardword" */
     while (n--) {
-	while ((x > lim) && iblank(line[x - 1]))
+	while ((x > lim) && iblank(zleline[x - 1]))
 	    x--;
-	if (iident(line[x - 1]))
-	    while ((x > lim) && iident(line[x - 1]))
+	if (iident(zleline[x - 1]))
+	    while ((x > lim) && iident(zleline[x - 1]))
 		x--;
 	else
-	    while ((x > lim) && !iident(line[x - 1]) && !iblank(line[x - 1]))
+	    while ((x > lim) && !iident(zleline[x - 1]) && !iblank(zleline[x - 1]))
 		x--;
     }
-    backkill(cs - x, 1);
+    backkill(zlecs - x, 1);
     return 0;
 }
 
@@ -321,7 +321,7 @@ vibackwardkillword(UNUSED(char **args))
 int
 backwardkillword(char **args)
 {
-    int x = cs;
+    int x = zlecs;
     int n = zmult;
 
     if (n < 0) {
@@ -332,12 +332,12 @@ backwardkillword(char **args)
 	return ret;
     }
     while (n--) {
-	while (x && !iword(line[x - 1]))
+	while (x && !iword(zleline[x - 1]))
 	    x--;
-	while (x && iword(line[x - 1]))
+	while (x && iword(zleline[x - 1]))
 	    x--;
     }
-    backkill(cs - x, 1);
+    backkill(zlecs - x, 1);
     return 0;
 }
 
@@ -346,20 +346,20 @@ int
 upcaseword(UNUSED(char **args))
 {
     int n = zmult;
-    int neg = n < 0, ocs = cs;
+    int neg = n < 0, ocs = zlecs;
 
     if (neg)
 	n = -n;
     while (n--) {
-	while (cs != ll && !iword(line[cs]))
-	    cs++;
-	while (cs != ll && iword(line[cs])) {
-	    line[cs] = tuupper(line[cs]);
-	    cs++;
+	while (zlecs != zlell && !iword(zleline[zlecs]))
+	    zlecs++;
+	while (zlecs != zlell && iword(zleline[zlecs])) {
+	    zleline[zlecs] = tuupper(zleline[zlecs]);
+	    zlecs++;
 	}
     }
     if (neg)
-	cs = ocs;
+	zlecs = ocs;
     return 0;
 }
 
@@ -368,20 +368,20 @@ int
 downcaseword(UNUSED(char **args))
 {
     int n = zmult;
-    int neg = n < 0, ocs = cs;
+    int neg = n < 0, ocs = zlecs;
 
     if (neg)
 	n = -n;
     while (n--) {
-	while (cs != ll && !iword(line[cs]))
-	    cs++;
-	while (cs != ll && iword(line[cs])) {
-	    line[cs] = tulower(line[cs]);
-	    cs++;
+	while (zlecs != zlell && !iword(zleline[zlecs]))
+	    zlecs++;
+	while (zlecs != zlell && iword(zleline[zlecs])) {
+	    zleline[zlecs] = tulower(zleline[zlecs]);
+	    zlecs++;
 	}
     }
     if (neg)
-	cs = ocs;
+	zlecs = ocs;
     return 0;
 }
 
@@ -390,24 +390,24 @@ int
 capitalizeword(UNUSED(char **args))
 {
     int first, n = zmult;
-    int neg = n < 0, ocs = cs;
+    int neg = n < 0, ocs = zlecs;
 
     if (neg)
 	n = -n;
     while (n--) {
 	first = 1;
-	while (cs != ll && !iword(line[cs]))
-	    cs++;
-	while (cs != ll && iword(line[cs]) && !isalpha(line[cs]))
-	    cs++;
-	while (cs != ll && iword(line[cs])) {
-	    line[cs] = (first) ? tuupper(line[cs]) : tulower(line[cs]);
+	while (zlecs != zlell && !iword(zleline[zlecs]))
+	    zlecs++;
+	while (zlecs != zlell && iword(zleline[zlecs]) && !isalpha(zleline[zlecs]))
+	    zlecs++;
+	while (zlecs != zlell && iword(zleline[zlecs])) {
+	    zleline[zlecs] = (first) ? tuupper(zleline[zlecs]) : tulower(zleline[zlecs]);
 	    first = 0;
-	    cs++;
+	    zlecs++;
 	}
     }
     if (neg)
-	cs = ocs;
+	zlecs = ocs;
     return 0;
 }
 
@@ -415,7 +415,7 @@ capitalizeword(UNUSED(char **args))
 int
 deleteword(char **args)
 {
-    int x = cs;
+    int x = zlecs;
     int n = zmult;
 
     if (n < 0) {
@@ -426,12 +426,12 @@ deleteword(char **args)
 	return ret;
     }
     while (n--) {
-	while (x != ll && !iword(line[x]))
+	while (x != zlell && !iword(zleline[x]))
 	    x++;
-	while (x != ll && iword(line[x]))
+	while (x != zlell && iword(zleline[x]))
 	    x++;
     }
-    foredel(x - cs);
+    foredel(x - zlecs);
     return 0;
 }
 
@@ -439,7 +439,7 @@ deleteword(char **args)
 int
 killword(char **args)
 {
-    int x = cs;
+    int x = zlecs;
     int n = zmult;
 
     if (n < 0) {
@@ -450,12 +450,12 @@ killword(char **args)
 	return ret;
     }
     while (n--) {
-	while (x != ll && !iword(line[x]))
+	while (x != zlell && !iword(zleline[x]))
 	    x++;
-	while (x != ll && iword(line[x]))
+	while (x != zlell && iword(zleline[x]))
 	    x++;
     }
-    forekill(x - cs, 0);
+    forekill(x - zlecs, 0);
     return 0;
 }
 
@@ -463,39 +463,39 @@ killword(char **args)
 int
 transposewords(UNUSED(char **args))
 {
-    int p1, p2, p3, p4, x = cs;
+    int p1, p2, p3, p4, x = zlecs;
     char *temp, *pp;
     int n = zmult;
-    int neg = n < 0, ocs = cs;
+    int neg = n < 0, ocs = zlecs;
 
     if (neg)
 	n = -n;
     while (n--) {
-	while (x != ll && line[x] != '\n' && !iword(line[x]))
+	while (x != zlell && zleline[x] != '\n' && !iword(zleline[x]))
 	    x++;
-	if (x == ll || line[x] == '\n') {
-	    x = cs;
-	    while (x && line[x - 1] != '\n' && !iword(line[x]))
+	if (x == zlell || zleline[x] == '\n') {
+	    x = zlecs;
+	    while (x && zleline[x - 1] != '\n' && !iword(zleline[x]))
 		x--;
-	    if (!x || line[x - 1] == '\n')
+	    if (!x || zleline[x - 1] == '\n')
 		return 1;
 	}
-	for (p4 = x; p4 != ll && iword(line[p4]); p4++);
-	for (p3 = p4; p3 && iword(line[p3 - 1]); p3--);
+	for (p4 = x; p4 != zlell && iword(zleline[p4]); p4++);
+	for (p3 = p4; p3 && iword(zleline[p3 - 1]); p3--);
 	if (!p3)
 	    return 1;
-	for (p2 = p3; p2 && !iword(line[p2 - 1]); p2--);
+	for (p2 = p3; p2 && !iword(zleline[p2 - 1]); p2--);
 	if (!p2)
 	    return 1;
-	for (p1 = p2; p1 && iword(line[p1 - 1]); p1--);
+	for (p1 = p2; p1 && iword(zleline[p1 - 1]); p1--);
 	pp = temp = (char *)zhalloc(p4 - p1 + 1);
-	struncpy(&pp, (char *) line + p3, p4 - p3);
-	struncpy(&pp, (char *) line + p2, p3 - p2);
-	struncpy(&pp, (char *) line + p1, p2 - p1);
-	strncpy((char *)line + p1, temp, p4 - p1);
-	cs = p4;
+	struncpy(&pp, (char *) zleline + p3, p4 - p3);
+	struncpy(&pp, (char *) zleline + p2, p3 - p2);
+	struncpy(&pp, (char *) zleline + p1, p2 - p1);
+	strncpy((char *)zleline + p1, temp, p4 - p1);
+	zlecs = p4;
     }
     if (neg)
-	cs = ocs;
+	zlecs = ocs;
     return 0;
 }