about summary refs log tree commit diff
path: root/Src/Zle/compresult.c
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/compresult.c
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/compresult.c')
-rw-r--r--Src/Zle/compresult.c246
1 files changed, 123 insertions, 123 deletions
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;