From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: completion for perl
Date: Tue, 14 Mar 2000 09:12:10 +0100 (MET) [thread overview]
Message-ID: <200003140812.JAA01164@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Adam Spiers's message of Mon, 13 Mar 2000 17:10:31 +0000
Adam Spiers wrote:
> Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote:
> >
> > Adam Spiers wrote:
> >
> > > Whilst struggling with the mess which is _perl_config_vars below, it
> > > struck me how an equivalent of compset -P which matched the /whole/ of
> > > PREFIX rather than just the beginning would have come in handy.
> >
> > Err... `compset -P "*"' does that, but it leaves you with an empty
> > $PREFIX, of course, which is probably not what one wants.
>
> Sorry; I didn't explain myself clearly at all. I would like to be
> able to do a compset -P type of operation using a pattern which is
> anchored to both the start /and/ end of PREFIX, rather than just the
> start, which is what currently always happens. Then again, I suppose
> this can be implemented easily manually, e.g.:
>
> if [[ "$PREFIX" == *: ]]; then
> IPREFIX="$IPREFIX$PREFIX"
> PREFIX=''
> fi
Yep.
> ...
> >
> > The problem is that we check the quoting stuff at the very beginning
> > of the completion code -- and detect only quotes at the beginning of
> > the word. So what we could get to work is completion of
> >
> > $ perl '-V:<TAB>
> >
> > but not with the quote after the colon. That's done with first calling
> > `compset -q', then the `compset -P'. Getting quotes in words to work
> > is to hard to make me try it (all kinds of nasty interactions with the
> > lexer). But maybe calling first `compset -P' and then `compset -q'
> > should have the same effect as the other way round... I currently
> > don't remember why it behaves the way it does.
>
> So is there currently no solution? I tried using things like
>
> compset -P '*"'
>
> but they never matched, presumably because of the lexer interactions
> you mention.
Yes, the completion code doesn't see the in-word quotes (well, only
get_comp_string() sees the tokens for them, but we decided some time
ago that the completion code only keeps quotes at the beginning/end of
the word, generating some kind of `normalised' quoting).
But at least we should make `compset -q' work on the current value of
$PREFIX/$SUFFIX, keeping $IPREFIX/$ISUFFIX ignored (that's what I
meant in my last mail). The patch below does that.
Bye
Sven
diff -ru ../z.old/Src/Zle/compcore.c Src/Zle/compcore.c
--- ../z.old/Src/Zle/compcore.c Tue Mar 14 09:06:21 2000
+++ Src/Zle/compcore.c Tue Mar 14 09:11:36 2000
@@ -1148,11 +1148,11 @@
LinkNode n;
int owe = we, owb = wb, ocs = cs, swb, swe, scs, soffs, ne = noerrs;
int tl, got = 0, i = 0, cur = -1, oll = ll, sl, remq;
- int ois = instring, oib = inbackt, noffs = lip + lp;
+ int ois = instring, oib = inbackt, noffs = lp;
char *tmp, *p, *ns, *ol = (char *) line, sav, *qp, *qs, *ts, qc = '\0';
- if (compisuffix)
- s = dyncat(s, compisuffix);
+ s += lip;
+ wb += lip;
untokenize(s);
swb = swe = soffs = 0;
@@ -1343,16 +1343,16 @@
untokenize(ss);
compsuffix = ztrdup(ss);
}
- zsfree(compiprefix);
- compiprefix = ztrdup("");
- zsfree(compisuffix);
- compisuffix = ztrdup("");
- tmp = tricat(compqiprefix, "", multiquote(qp, 1));
+ tmp = tricat(compqiprefix, compiprefix, multiquote(qp, 1));
zsfree(compqiprefix);
compqiprefix = tmp;
- tmp = tricat(multiquote(qs, 1), "", compqisuffix);
+ tmp = tricat(multiquote(qs, 1), compisuffix, compqisuffix);
zsfree(compqisuffix);
compqisuffix = tmp;
+ zsfree(compiprefix);
+ compiprefix = ztrdup("");
+ zsfree(compisuffix);
+ compisuffix = ztrdup("");
freearray(compwords);
i = countlinknodes(foo);
compwords = (char **) zalloc((i + 1) * sizeof(char *));
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2000-03-14 8:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-14 8:12 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-03-13 10:57 Sven Wischnowsky
2000-03-13 17:10 ` Adam Spiers
2000-03-12 13:28 Adam Spiers
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=200003140812.JAA01164@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).