Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

zsh-3.0.6-pre-2: clear list



Here's the patch for the current state we have in pws-17. I've done a
bit of testing and it seems to work nicely, but I don't have the time
to test all possible key-bindings. Maybe someone else...?

Bye
 Sven

P.S.: Most of this is exactly as in 3.1.5, so I don't expect many
      problems that aren't present in 3.1.5, too.

--- Src/zle_hist.c.old	Tue May  4 17:06:09 1999
+++ Src/zle_hist.c	Tue May  4 17:10:41 1999
@@ -543,6 +543,7 @@
     stackcs = cs;
     *line = '\0';
     ll = cs = 0;
+    clearlist = 1;
 }
 
 /**/
@@ -568,6 +569,7 @@
     if (!isfirstln) {
 	errflag = done = 1;
     }
+    clearlist = 1;
 }
 
 /**/
@@ -597,6 +599,7 @@
 	memcpy((char *)line + cs, s, cc);
 	cs += cc;
 	free(s);
+	clearlist = 1;
     }
 }
 
@@ -673,6 +676,8 @@
     static char *previous_search = NULL;
     static int previous_search_len = 0;
 
+    clearlist = 1;
+
     strcpy(ibuf, ISEARCH_PROMPT);
     memcpy(ibuf + NORM_PROMPT_POS, (dir == 1) ? "fwd" : "bck", 3);
     remember_edits();
@@ -959,6 +964,7 @@
 	zsfree(visrchstr);
 	visrchstr = NULL;
     }
+    clearlist = 1;
     statusline = sbuf;
     sbuf[0] = (visrchsense == -1) ? '?' : '/';
     bindtab = mainbindtab;
--- Src/zle_main.c.old	Tue May  4 17:06:16 1999
+++ Src/zle_main.c	Tue May  4 17:12:29 1999
@@ -1109,6 +1109,7 @@
 
     if (statusline)
 	return;
+    clearlist = 1;
     statusline = "Describe key briefly: _";
     statusll = strlen(statusline);
     refresh();
@@ -1208,7 +1209,7 @@
 	moveto(nlnct, 0);
 	if (clearflag && tccan(TCCLEAREOD)) {
 	    tcout(TCCLEAREOD);
-	    clearflag = 0;
+	    clearflag = listshown = 0;
 	}
 	if (postedit)
 	    fprintf(shout, "%s", postedit);
--- Src/zle_misc.c.old	Tue May  4 17:06:24 1999
+++ Src/zle_misc.c	Tue May  4 17:16:44 1999
@@ -129,6 +129,7 @@
 	for (i = cs; i != ll && line[i] != '\n'; i++);
 	forekill(i - cs + (i != ll), fg);
     }
+    clearlist = 1;
 }
 
 /**/
@@ -137,6 +138,7 @@
 {
     cs = 0;
     forekill(ll, 0);
+    clearlist = 1;
 }
 
 /**/
@@ -158,6 +160,7 @@
 		cs--, i++;
     }
     forekill(i, 1);
+    clearlist = 1;
 }
 
 /**/
@@ -287,6 +290,7 @@
 		cs++, i++;
     }
     backkill(i, 0);
+    clearlist = 1;
 }
 
 /**/
@@ -548,10 +552,11 @@
 int
 executenamedcommand(char *prmt)
 {
-    int len, cmd, t0, l = strlen(prmt);
+    int len, cmd, t0, l = strlen(prmt), ols = listshown;
     char *ptr, *buf = halloc(l + NAMLEN + 2);
     int *obindtab = bindtab;
 
+    clearlist = 1;
     strcpy(buf, prmt);
     statusline = buf;
     bindtab = mainbindtab;
@@ -564,6 +569,10 @@
 	if ((cmd = getkeycmd()) < 0 || cmd == z_sendbreak) {
 	    statusline = NULL;
 	    bindtab = obindtab;
+	    if ((listshown = ols))
+		showinglist = -2;
+	    else
+		clearlist = 1;
 	    return -1;
 	}
 	switch (cmd) {
@@ -617,6 +626,10 @@
 	    if (t0 != ZLECMDCOUNT) {
 		statusline = NULL;
 		bindtab = obindtab;
+		if ((listshown = ols))
+		    showinglist = -2;
+		else
+		    clearlist = 1;
 		return t0;
 	    }
 	    /* fall through */
--- Src/zle_refresh.c.old	Tue May  4 17:06:35 1999
+++ Src/zle_refresh.c	Tue May  4 17:26:22 1999
@@ -61,6 +61,16 @@
 static unsigned pmpt_attr = 0,	/* text attributes after displaying prompt  */
     rpmpt_attr = 0;		/* text attributes after displaying rprompt */
 
+/* Non-zero if a completion list was displayed. */
+
+/**/
+int listshown;
+
+/* Non-zero if refresh() should clear the list below the prompt. */
+
+/**/
+int clearlist;
+
 /**/
 void
 resetvideo(void)
@@ -220,6 +230,23 @@
     if (inlist)
 	return;
 
+    if (clearlist && listshown) {
+	if (tccan(TCCLEAREOD)) {
+	    int ovln = vln, ovcs = vcs;
+
+	    moveto(nlnct, 0);
+	    tcout(TCCLEAREOD);
+	    moveto(ovln, ovcs);
+	} else {
+	    invalidatelist();
+	    moveto(0, 0);
+	    clearflag = 0;
+	    resetneeded = 1;
+	}
+	listshown = showinglist = 0;
+    }
+    clearlist = 0;
+
 #ifdef HAVE_SELECT
     cost = 0;			/* reset */
 #endif
@@ -243,6 +270,7 @@
 	    moveto(0, 0);
 	    t0 = olnct;		/* this is to clear extra lines even when */
 	    winchanged = 0;	/* the terminal cannot TCCLEAREOD	  */
+	    listshown = 0;
 	}
 #endif
 	resetvideo();
@@ -259,6 +287,7 @@
                 tcout(TCCLEAREOD);
             else
                 cleareol = 1;   /* request: clear to end of line */
+	    listshown = 0;
 	}
         if (t0 > -1)
             olnct = t0;
--- Src/zle_tricky.c.old	Tue May  4 17:06:45 1999
+++ Src/zle_tricky.c	Tue May  4 17:23:54 1999
@@ -187,6 +187,10 @@
 
 static int amenu;
 
+/* Non-zero if we have to redisplay the list of matches. */
+
+static int showagain = 0;
+
 /* Find out if we have to insert a tab (instead of trying to complete). */
 
 /**/
@@ -492,6 +496,10 @@
     char *s, *ol;
     int olst = lst, chl = 0, ne = noerrs, ocs;
 
+    if (showagain && validlist)
+	showinglist = -2;
+    showagain = 0;
+
     /* If we are doing a menu-completion... */
 
     if (menucmp && lst != COMP_LIST_EXPAND) {
@@ -2129,6 +2137,7 @@
 	if(makecomplist(s, incmd, &delit, &compadd, untokenized)) {
 	    /* Error condition: feeeeeeeeeeeeep(). */
 	    feep();
+	    clearlist = 1;
 	    goto compend;
 	}
 
@@ -3186,6 +3195,7 @@
 	if(isset(LISTAMBIGUOUS) && inv && !am) {
 	    invalidatelist();
 	    lastambig = 0;
+	    clearlist = 1;
 	    return;
 	}
     }
@@ -3535,7 +3545,7 @@
     /* Set the cursor below the prompt. */
     trashzle();
     ct = nmatches;
-    showinglist = 0;
+    showinglist = listshown = 0;
 
     clearflag = (isset(USEZLE) && !termflags &&
 		 (isset(ALWAYSLASTPROMPT) && !gotmult)) ||
@@ -3680,6 +3690,7 @@
 	if (up < lines) {
 	    tcmultout(TCUP, TCMULTUP, up);
 	    showinglist = -1;
+	    listshown = 1;
 	} else
 	    clearflag = 0, putc('\n', shout);
     }
@@ -3696,6 +3707,9 @@
     int nm = nmatches, vl = validlist;
     char **am = amatches;
     char *ex = expl;
+
+    if (listshown)
+	showagain = 1;
 
     haswhat = HAS_MISC;
     ispattern = 0;
--- Src/zle_utils.c.old	Tue May  4 17:11:07 1999
+++ Src/zle_utils.c	Tue May  4 17:11:22 1999
@@ -185,6 +185,7 @@
     unmetafy((char *) line, &ll);
     if ((cs = ll) && bindtab == altbindtab)
 	cs--;
+    clearlist = 1;
 }
 
 /**/
--- Src/zle_vi.c.old	Tue May  4 17:06:54 1999
+++ Src/zle_vi.c	Tue May  4 17:25:06 1999
@@ -505,6 +505,7 @@
     spaceinline(1);
     line[cs++] = '\n';
     startvitext(1);
+    clearlist = 1;
 }
 
 /**/
@@ -515,6 +516,7 @@
     spaceinline(1);
     line[cs] = '\n';
     startvitext(1);
+    clearlist = 1;
 }
 
 /**/
@@ -780,6 +782,7 @@
 void
 vicapslockpanic(void)
 {
+    clearlist = 1;
     feep();
     statusline = "press a lowercase key to continue";
     statusll = strlen(statusline);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author