about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-10-25 08:18:43 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-10-25 08:18:43 +0000
commit9e44b5ea29c073e553a86b5fe50b66e25437e375 (patch)
tree21547e77800e7500826d2bbb8a33599b085c7453
parentead3cee30d59283b315e9b16b136ed5dd1198340 (diff)
downloadzsh-9e44b5ea29c073e553a86b5fe50b66e25437e375.tar.gz
zsh-9e44b5ea29c073e553a86b5fe50b66e25437e375.tar.xz
zsh-9e44b5ea29c073e553a86b5fe50b66e25437e375.zip
add a counter for invalidatelist() to allow finding out if there is a new list (13082)
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/complist.c5
-rw-r--r--Src/Zle/compresult.c13
3 files changed, 20 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 2384b6893..6687d0041 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-10-25  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 13082: Src/Zle/complist.c, Src/Zle/compresult.c: add a counter
+ 	for invalidatelist() to allow finding out if there is a new list
+	
 2000-10-24  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 13071: Src/Zle/complist.c, Src/Zle/compresult.c: avoid printing
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index af8dea6f0..3e746b914 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -986,7 +986,7 @@ compnicezputs(char *s, int ml)
 static int
 compprintlist(int showall)
 {
-    static int lasttype = 0, lastbeg = 0, lastml = 0;
+    static int lasttype = 0, lastbeg = 0, lastml = 0, lastinvcount = -1;
     static int lastn = 0, lastnl = 0, lastnlnct = -1;
     static Cmgroup lastg = NULL;
     static Cmatch *lastp = NULL;
@@ -999,7 +999,7 @@ compprintlist(int showall)
     int lastused = 0;
 
     mfirstl = -1;
-    if (mnew || lastbeg != mlbeg || mlbeg < 0) {
+    if (mnew || lastinvcount != invcount || lastbeg != mlbeg || mlbeg < 0) {
 	lasttype = 0;
 	lastg = NULL;
 	lastexpl = NULL;
@@ -1010,6 +1010,7 @@ compprintlist(int showall)
 	  lines - nlnct - mhasstat : listdat.nlines) - (lastnlnct > nlnct);
     lastnlnct = nlnct;
     mrestlines = lines - 1;
+    lastinvcount = invcount;
 
     if (cl < 2) {
 	cl = -1;
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 13ae8c3b3..7b2707681 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -30,6 +30,12 @@
 #include "complete.mdh"
 #include "compresult.pro"
 
+/* This counts how often the list of completions was invalidated.
+ * Can be used to detect if we have a new list.  */
+
+/**/
+mod_export int invcount;
+
 #define inststr(X) inststrlen((X),1,-1)
 
 /* This cuts the cline list before the stuff that isn't worth
@@ -1264,6 +1270,8 @@ skipnolist(Cmatch *p, int showall)
 mod_export int
 calclist(int showall)
 {
+    static int lastinvcount = -1;
+
     Cmgroup g;
     Cmatch *p, m;
     Cexpl *e;
@@ -1271,10 +1279,12 @@ calclist(int showall)
     int max = 0, i;
     VARARR(int, mlens, nmatches + 1);
 
-    if (listdat.valid && onlyexpl == listdat.onlyexpl &&
+    if (lastinvcount == invcount &&
+	listdat.valid && onlyexpl == listdat.onlyexpl &&
 	menuacc == listdat.menuacc && showall == listdat.showall &&
 	lines == listdat.lines && columns == listdat.columns)
 	return 0;
+    lastinvcount = invcount;
 
     for (g = amatches; g; g = g->next) {
 	char **pp = g->ylist;
@@ -2089,6 +2099,7 @@ list_matches(Hookdef dummy, void *dummy2)
 mod_export int
 invalidate_list(void)
 {
+    invcount++;
     if (validlist) {
 	if (showinglist == -2)
 	    zrefresh();