From: Peter Stephenson <pws@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 [thread overview]
Message-ID: <9907131531.AA34560@ibmth.df.unipi.it> (raw)
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 <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
next reply other threads:[~1999-07-13 16:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-07-13 15:31 Peter Stephenson [this message]
1999-07-14 7:57 Sven Wischnowsky
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=9907131531.AA34560@ibmth.df.unipi.it \
--to=pws@ibmth.df.unipi.it \
--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).