From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: If someone wants to try...
Date: Thu, 20 Jan 2000 09:26:38 +0100 (MET) [thread overview]
Message-ID: <200001200826.JAA20658@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Wed, 19 Jan 2000 19:38:33 +0000
Peter Stephenson wrote:
> Sven Wischnowsky wrote:
> ...
> > And maybe we should try to avoid building values for arrays and hashes
> > when completing their names (it's autoparamslash if I'm not completely
> > mistaken). No patch for this yet.
>
> Yes, something similar is going on with $mapfile which I noticed before,
> although maybe this is deeper in the parameter code: it always executes the
> special function to retrieve the value, even if you're about to assign to
> it.
In this case it really only was do_single() which called singsub() to
see if the word expanded to a directory name. The patch makes it test
if it's a simple parameter expansion (`$foo' or `${foo}', no flags, no
subscripts) and if it is and the parameter is not a scalar, we don't
try to expand it.
Bye
Sven
diff -ru ../z.old/Src/Zle/compresult.c Src/Zle/compresult.c
--- ../z.old/Src/Zle/compresult.c Thu Jan 20 09:07:24 2000
+++ Src/Zle/compresult.c Thu Jan 20 09:08:40 2000
@@ -785,19 +785,40 @@
else {
/* Build the path name. */
if (partest && !*psuf && !(m->flags & CMF_PARNEST)) {
- int ne = noerrs;
+ int ne = noerrs, tryit = 1;
p = (char *) zhalloc(strlen((m->flags & CMF_ISPAR) ?
parpre : m->ripre) +
strlen(str) + 2);
sprintf(p, "%s%s%c",
((m->flags & CMF_ISPAR) ? parpre : m->ripre), str,
- ((m->flags & CMF_PARBR) ? Outbrace : '\0'));
- noerrs = 1;
- parsestr(p);
- singsub(&p);
- errflag = 0;
- noerrs = ne;
+ ((m->flags & CMF_PARBR) ? '}' : '\0'));
+ if (*p == '$') {
+ char *n;
+ Param pm;
+
+ if (p[1] == '{') {
+ char *e;
+
+ n = dupstring(p + 2);
+ e = n + strlen(n) - 1;
+
+ if (*e == '}')
+ *e = '\0';
+ } else
+ n = p + 1;
+
+ if ((pm = (Param) paramtab->getnode(paramtab, n)) &&
+ PM_TYPE(pm->flags) != PM_SCALAR)
+ tryit = 0;
+ }
+ if (tryit) {
+ noerrs = 1;
+ parsestr(p);
+ singsub(&p);
+ errflag = 0;
+ noerrs = ne;
+ }
} else {
p = (char *) zhalloc(strlen(prpre) + strlen(str) +
strlen(psuf) + 3);
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2000-01-20 8:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-20 8:26 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-01-19 15:46 Sven Wischnowsky
2000-01-19 19:38 ` Peter Stephenson
2000-01-19 14:02 Sven Wischnowsky
2000-01-19 8:59 Sven Wischnowsky
2000-01-19 11:05 ` Alexandre Duret-Lutz
2000-01-18 10:09 Sven Wischnowsky
2000-01-17 12:50 Sven Wischnowsky
2000-01-18 22:49 ` Tanaka Akira
2000-01-19 12:48 ` Peter Stephenson
2000-01-19 12:53 ` Peter Stephenson
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=200001200826.JAA20658@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).