From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21569 invoked from network); 13 Jul 1999 16:02:35 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Jul 1999 16:02:35 -0000 Received: (qmail 11295 invoked by alias); 13 Jul 1999 16:02:15 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7119 Received: (qmail 11288 invoked from network); 13 Jul 1999 16:02:12 -0000 Message-Id: <9907131531.AA34560@ibmth.df.unipi.it> To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Subject: PATCH: 3.1.6-test-1: expansion return status Date: Tue, 13 Jul 1999 17:31:07 +0200 From: Peter Stephenson The standard expansion widgets (^X*, ^Xg) don't get the status right, and hence feep too often. This seems to fix the problem by counting the number of matches. Probably _expand works OK, but I haven't been using that. (Hey, look, I wrote a completion patch!) What I haven't attempted to get right is that the list should also be cleared if there are no matches. --- Src/Zle/zle_tricky.c.exp Tue Jul 13 10:33:14 1999 +++ Src/Zle/zle_tricky.c Tue Jul 13 17:23:40 1999 @@ -1017,7 +1017,7 @@ int ocs = cs, ne = noerrs; noerrs = 1; - doexpansion(s, lst, olst, lincmd); + ret = doexpansion(s, lst, olst, lincmd); lastambig = 0; noerrs = ne; @@ -1043,8 +1043,7 @@ } } ret = docompletion(s, lst, lincmd); - } else - ret = !strcmp(ol, (char *) line); + } } else /* Just do completion. */ ret = docompletion(s, lst, lincmd); @@ -1736,9 +1735,10 @@ /* Expand the current word. */ /**/ -static void +static int doexpansion(char *s, int lst, int olst, int explincmd) { + int ret = 1; LinkList vl; char *ss; @@ -1775,7 +1775,7 @@ } if (lst == COMP_LIST_EXPAND) { /* Only the list of expansions was requested. */ - listlist(vl); + ret = listlist(vl); showinglist = 0; goto end; } @@ -1783,6 +1783,7 @@ cs = wb; foredel(we - wb); while ((ss = (char *)ugetnode(vl))) { + ret = 0; untokenize(ss); ss = quotename(ss, NULL); inststr(ss); @@ -1801,6 +1802,8 @@ end: popheap(); } LASTALLOC; + + return ret; } /* This is called from the lexer to give us word positions. */ @@ -8179,7 +8182,7 @@ /* This is used to print expansions. */ /**/ -void +int listlist(LinkList l) { struct cmgroup dg; @@ -8202,6 +8205,8 @@ validlist = vl; smatches = sm; complastprompt = oclp; + + return !dg.lcount; } /* Expand the history references. */ -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy