From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Completion in braces limitation
Date: Tue, 27 Apr 1999 15:37:18 +0200 (MET DST) [thread overview]
Message-ID: <199904271337.PAA13588@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Oliver Kiddle's message of Tue, 27 Apr 1999 13:56:22 +0100
Oliver Kiddle wrote:
> Completion in braces doesn't seem to work in combination with variables:
>
> zsh -f
> less $PWD/<tab> - beep and lists files
> less $PWD/{<tab> - just beeps
This was intentional, the completion gave up as soon as it found the `$'.
The patch below makes it try a little harder by looking at what comes
after the `$'. If there is a complete parameter expansion and the
opening brace from the brace expansion comes after it, this should
work now.
I would be thankful if someone (you?) could test this more thoroughly,
though.
> Another feature which would be useful is if completion of variables was
> extended to
> properly handle associative arrays. So for example, if I have an
> associative array named 'test',
> cd $test[<tab>
> would complete from the list of keys in $test.
Well, the new style completion can do this, of course...
And: I /think/ I already mentioned this some time ago (I knew someone
would say that he would like to have it). I don't remember exactly,
but I think I foresaw some problem there (mainly due to the code, I
think, not in what the user sees). There might be some ugly
interaction with normal subscripts...
So, no patch for this now. Sorry.
Bye
Sven
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c Tue Apr 27 13:06:22 1999
+++ Src/Zle/zle_tricky.c Tue Apr 27 15:29:04 1999
@@ -1515,12 +1515,46 @@
*/
for (i = 0, p = s; *p; p++, i++) {
/* careful, ${... is not a brace expansion...
- * in fact, if it's got a substitution in it's too
- * hard for us anyway. sorry.
+ * we try to get braces after a parameter expansion right,
+ * but this may fail sometimes. sorry.
*/
if (*p == String || *p == Qstring) {
- tt = NULL;
- break;
+ if (p[1] == Inbrace) {
+ char *tp = p + 1;
+ if (skipparens(Inbrace, Outbrace, &tp)) {
+ tt = NULL;
+ break;
+ }
+ i += tp - p;
+ p = tp;
+ } else {
+ char *tp = p + 1;
+
+ if (*tp == Quest || *tp == Star || *tp == String ||
+ *tp == Qstring || *tp == '?' || *tp == '*' ||
+ *tp == '$' || *tp == '-' || *tp == '!' ||
+ *tp == '@')
+ p++, i++;
+ else {
+ if (idigit(*tp))
+ while (idigit(*tp))
+ tp++;
+ else if (iident(*tp))
+ while (iident(*tp))
+ tp++;
+ else {
+ tt = NULL;
+ break;
+ }
+ if (*tp == Inbrace) {
+ tt = NULL;
+ break;
+ }
+ tp--;
+ i += tp - p;
+ p = tp;
+ }
+ }
} else if (*p == Inbrace) {
if (tt) {
/* too many inbraces */
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-04-27 13:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-27 13:37 Sven Wischnowsky [this message]
1999-04-27 15:45 ` Oliver Kiddle
-- strict thread matches above, loose matches on Subject: below --
1999-05-03 9:25 Sven Wischnowsky
1999-04-28 7:19 Sven Wischnowsky
1999-04-28 16:43 ` Bart Schaefer
1999-04-27 12:56 Oliver Kiddle
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=199904271337.PAA13588@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).