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

PATCH: removing completion lists



This patch does two things:

1) cleanup for the code that removes the completion list for zle
   functions that use the statusline; This is very simple now, you
   only have to set the variable `clearlist' to non-zero and
   zrefresh() will do the rest
2) use this to remove completion lists when completion is attempted
   and generates no match; I'm not if you like this, but somehow this
   `feels' good if you have all the beeps turned off (only now will
   you get visual feedback that something went wrong)

Anyway, if 2) is not wanted, I can easily produce a patch without it.


Bye
 Sven

diff -u os/Zle/zle_hist.c Src/Zle/zle_hist.c
--- os/Zle/zle_hist.c	Fri Feb 12 12:03:21 1999
+++ Src/Zle/zle_hist.c	Fri Feb 12 13:18:08 1999
@@ -663,10 +663,7 @@
     static char *previous_search = NULL;
     static int previous_search_len = 0;
 
-    invalidatelist();
-    moveto(0, 0);
-    clearflag = 0;
-    resetneeded = 1; 
+    clearlist = 1;
 
     strcpy(ibuf, ISEARCH_PROMPT);
     memcpy(ibuf + NORM_PROMPT_POS, (dir == 1) ? "fwd" : "bck", 3);
@@ -948,10 +945,7 @@
 	zsfree(visrchstr);
 	visrchstr = NULL;
     }
-    invalidatelist();
-    moveto(0, 0);
-    clearflag = 0;
-    resetneeded = 1; 
+    clearlist = 1;
     statusline = sbuf;
     sbuf[0] = (visrchsense == -1) ? '?' : '/';
     selectkeymap("main", 1);
diff -u os/Zle/zle_main.c Src/Zle/zle_main.c
--- os/Zle/zle_main.c	Fri Feb 12 12:03:21 1999
+++ Src/Zle/zle_main.c	Fri Feb 12 13:12:07 1999
@@ -792,10 +792,7 @@
 
     if (statusline)
 	return;
-    invalidatelist();
-    moveto(0, 0);
-    clearflag = 0;
-    resetneeded = 1; 
+    clearlist = 1;
     statusline = "Describe key briefly: _";
     statusll = strlen(statusline);
     zrefresh();
diff -u os/Zle/zle_misc.c Src/Zle/zle_misc.c
--- os/Zle/zle_misc.c	Fri Feb 12 12:03:21 1999
+++ Src/Zle/zle_misc.c	Fri Feb 12 13:12:21 1999
@@ -612,10 +612,7 @@
     char *ptr;
     char *okeymap = curkeymapname;
 
-    invalidatelist();
-    moveto(0, 0);
-    clearflag = 0;
-    resetneeded = 1; 
+    clearlist = 1;
     cmdbuf = halloc(l + NAMLEN + 2);
     strcpy(cmdbuf, prmt);
     statusline = cmdbuf;
diff -u os/Zle/zle_refresh.c Src/Zle/zle_refresh.c
--- os/Zle/zle_refresh.c	Fri Feb 12 12:03:21 1999
+++ Src/Zle/zle_refresh.c	Fri Feb 12 13:11:58 1999
@@ -60,6 +60,11 @@
 /**/
 int clearflag;
 
+/* Non-zero if zrefresh() should clear the list below the prompt. */
+
+/**/
+int clearlist;
+
 #ifdef HAVE_SELECT
 /* cost of last update */
 /**/
@@ -248,6 +253,13 @@
     if (inlist)
 	return;
 
+    if (clearlist) {
+	invalidatelist();
+	moveto(0, 0);
+	clearflag = 0;
+	resetneeded = 1;
+	clearlist = 0;
+    }
 #ifdef HAVE_SELECT
     cost = 0;			/* reset */
 #endif
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Fri Feb 12 12:03:22 1999
+++ Src/Zle/zle_tricky.c	Fri Feb 12 13:29:33 1999
@@ -3278,9 +3278,9 @@
 	if (makecomplist(s, incmd, lst)) {
 	    /* Error condition: feeeeeeeeeeeeep(). */
 	    feep();
+	    clearlist = 1;
 	    goto compend;
 	}
-
 	if (lst == COMP_LIST_COMPLETE)
 	    /* All this and the guy only wants to see the list, sigh. */
 	    showinglist = -2;
diff -u os/Zle/zle_vi.c Src/Zle/zle_vi.c
--- os/Zle/zle_vi.c	Fri Feb 12 12:03:22 1999
+++ Src/Zle/zle_vi.c	Fri Feb 12 13:18:25 1999
@@ -816,10 +816,7 @@
 void
 vicapslockpanic(void)
 {
-    invalidatelist();
-    moveto(0, 0);
-    clearflag = 0;
-    resetneeded = 1; 
+    clearlist = 1;
     zbeep();
     statusline = "press a lowercase key to continue";
     statusll = strlen(statusline);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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