From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: 3.1.5-pws-8: setting duplicate elements of assoc array
Date: Fri, 19 Feb 1999 09:58:02 +0100 (MET) [thread overview]
Message-ID: <199902190858.JAA09439@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Thu, 18 Feb 1999 18:17:26 +0100
Peter Stephenson wrote:
> While doing this, I discovered two other bugs which I haven't fixed:
>
> 1)
> % __foo() { local list; list=(a b); complist -y '$list' -k list; }
> % defcomp __foo foo
> % foo ^D
> <random junk printed>
The problem was (of course) that the code used the array returned by
get*param() directly without copying it.
> I don't know if it's supposed to work when list is about to go out of
> scope, and there's an easy workaround `-y "($list)"' (provided $list
> doesn't have spaces or commas --- which it actually does in the case I was
> trying, so I seem to be stuck), but it shouldn't print what it did.
I think we should make it work, and it's simple.
> 2)
> % print ${foo%%
> ^ cursor here after space, hit tab, gives
> % print ${foo%% BUG: inbrace == '{' in paramsubst()
> BUG: inbrace == '{' in paramsubst()
> % print ${foo%%
I forgot to tokenize the '{' and '}'. This makes me think that the
ctokenize() function should be joined with tokenize() even more,
giving tokenize() an extra argument. But I'm reluctant to change every
call to tokenize()...
I also changed the test in getreal() so that the string returned by
prefork() is not used if it is empty (which was the case in such
situations). This is an incompatible change but previously the
`${foo%% ' disappeared and one got normal completion for an empty
prefix. Now the string typed so far is kept and completion is tried
with it as a prefix.
Bye
Sven
--- os/Zle/zle_tricky.c Thu Feb 18 15:57:34 1999
+++ Src/Zle/zle_tricky.c Fri Feb 19 09:40:22 1999
@@ -4559,7 +4559,8 @@
addlinknode(l, dupstring(str));
prefork(l, 0);
noerrs = ne;
- if (!errflag && nonempty(l))
+ if (!errflag && nonempty(l) &&
+ ((char *) peekfirst(l)) && ((char *) peekfirst(l))[0])
return dupstring(peekfirst(l));
errflag = 0;
@@ -4991,11 +4991,13 @@
if (*p == '\\')
bslash = 1;
else {
- if (*p == '$' || *p == '=') {
+ if (*p == '$' || *p == '=' || *p == '{' || *p == '}') {
if (bslash)
p[-1] = Bnull;
else
- *p = (*p == '$' ? String : Equals);
+ *p = (*p == '$' ? String :
+ (*p == '=' ? Equals :
+ (*p == '{' ? Inbrace : Outbrace)));
}
bslash = 0;
}
@@ -6484,15 +6486,17 @@
} else {
/* Otherwise it should be a parameter name. */
char **arr = NULL, *val;
- if (!(arr = getaparam(nam)) && !(arr = gethparam(nam)) &&
- (val = getsparam(nam))) {
+
+ if ((arr = getaparam(nam)) || (arr = gethparam(nam)))
+ return (incompfunc ? arrdup(arr) : arr);
+
+ if ((val = getsparam(nam))) {
arr = (char **)ncalloc(2*sizeof(char *));
arr[0] = val;
arr[1] = NULL;
}
return arr;
}
-
}
/* This is strcmp with ignoring backslashes. */
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-02-19 8:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-19 8:58 Sven Wischnowsky [this message]
1999-02-19 23:59 ` Bart Schaefer
-- strict thread matches above, loose matches on Subject: below --
1999-02-18 17:17 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=199902190858.JAA09439@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).