From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2993 invoked from network); 25 Oct 2000 08:18:09 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Oct 2000 08:18:09 -0000 Received: (qmail 25041 invoked by alias); 25 Oct 2000 08:17:40 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13082 Received: (qmail 25031 invoked from network); 25 Oct 2000 08:17:39 -0000 Date: Wed, 25 Oct 2000 10:17:35 +0200 (MET DST) Message-Id: <200010250817.KAA23761@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: mason@primenet.com.au's message of 25 Oct 2000 07:49:03 GMT Subject: Re: bug with completion (after 15 oct?) Geoff Wing wrote: > ... > > # then do > ls bals bals ba > # core dump Aha. It didn't find out that it had a new list. The patch adds a counter counting how often we have invalidated a completion list and then uses that counter to find out if the list displayed is the same as before. Bye Sven Index: Src/Zle/complist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v retrieving revision 1.35 diff -u -r1.35 complist.c --- Src/Zle/complist.c 2000/10/24 07:50:24 1.35 +++ Src/Zle/complist.c 2000/10/25 08:17:03 @@ -986,7 +986,7 @@ 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 @@ 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 @@ lines - nlnct - mhasstat : listdat.nlines) - (lastnlnct > nlnct); lastnlnct = nlnct; mrestlines = lines - 1; + lastinvcount = invcount; if (cl < 2) { cl = -1; Index: Src/Zle/compresult.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v retrieving revision 1.26 diff -u -r1.26 compresult.c --- Src/Zle/compresult.c 2000/10/24 07:50:25 1.26 +++ Src/Zle/compresult.c 2000/10/25 08:17:03 @@ -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 @@ mod_export int calclist(int showall) { + static int lastinvcount = -1; + Cmgroup g; Cmatch *p, m; Cexpl *e; @@ -1271,10 +1279,12 @@ 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 @@ mod_export int invalidate_list(void) { + invcount++; if (validlist) { if (showinglist == -2) zrefresh(); -- Sven Wischnowsky wischnow@informatik.hu-berlin.de