zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: bug with completion (after 15 oct?)
Date: Wed, 25 Oct 2000 10:17:35 +0200 (MET DST)	[thread overview]
Message-ID: <200010250817.KAA23761@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: mason@primenet.com.au's message of 25 Oct 2000 07:49:03 GMT


Geoff Wing wrote:

> ...
> 
> # then do
> ls ba<TAB><CTRL-U>ls ba<TAB><CTRL-U>ls ba<TAB>
> # 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


             reply	other threads:[~2000-10-25  8:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-25  8:17 Sven Wischnowsky [this message]
2000-10-25 10:24 ` Geoff Wing
  -- strict thread matches above, loose matches on Subject: below --
2000-10-25 10:51 Sven Wischnowsky
2000-10-25  7:14 Sven Wischnowsky
2000-10-25  7:49 ` Geoff Wing
2000-10-24 14:33 Geoff Wing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200010250817.KAA23761@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).