Zsh Mailing List Archive
Messages sorted by:
Re: wish for a colored completion system
- X-seq: zsh-workers 11869
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: wish for a colored completion system
- Date: Tue, 13 Jun 2000 11:25:23 +0200 (MET DST)
- In-reply-to: "Bart Schaefer"'s message of Sat, 10 Jun 2000 03:34:09 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> On Jun 9, 9:24am, Sven Wischnowsky wrote:
> } Subject: Re: wish for a colored completion system
> } Bart Schaefer wrote:
> } > I'm not sure why ':completion:*:ssh:*' doesn't work for the combined
> } > listing; perhaps it's a bug. Sven?
> } Hm, yes, the description in the docs make it sound as if it should
> } work. The problem is that without separate groups there is no way for
> } the completion code to find out that with
> } zstyle ':completion:*:ssh:*:hosts' list-colors '=a*=31'
> } zstyle ':completion:*:ssh:*:users' list-colors '=b*=32'
> } hosts starting with `b' should be coloured with `32'. We would need a
> } per-match colouring for that and that's too expensive.
> I think you misunderstood my question. I didn't ask why
> zstyle ':completion:*:ssh:*:hosts' list-colors '=a*=31'
> doesn't work. I asked why
> zstyle ':completion:*:ssh:*' list-colors '=a*=31'
> doesn't work. There isn't any group involved there at all; I don't ask
> for the hosts to be colored separately from the users; I just ask for
> anything that happens to be there (and that begins with `a') to work.
> But it doesn't, unless I set group-name ''.
;-) I understood that -- and noticed that the part you quoted doesn't
answer the question. That's why the next paragraph started the way it
> And to come back to the question, the completion code only looks up
> the style with the tag in the context and it can't find out that the
> pattern used in the definition doesn't contain the tag. If we wanted
> to solve that, we would have to make _setup get the name of the group
> (which may be -default-) as an argument (when called from
> _description) and use that name in ZLS_COLORS. But then we would be
> back to what I said above.
> So, we could (quite easily) change it, but that set-for-one-tag-and-
> used-for-others-too made me do it in the way we have it now, I would
> be willing to write the change if people say that they prefer it,
> though (I have group-name == '', so I don't care much about this).
I.e. _setup just uses the tag in ZLS_COLORS, as you've seen. To get
this right, we would shouldn't just make the colors be (almost) always
used (11847) because that works only for functions using the
argument-* tags. Probably even more confusing.
The problem is really that the code in _setup can't find out what
pattern was used when defining the style. It should use the value for
`...:*:ssh:*' everywhere but it should use the one defined for
`:...:*:ssh:*:hosts' only for names of hosts. But since complist only
distinguishes between groups (and it can only do that), a setting for
the latter pattern would be used for usernames, too, if they are in
the same group and we change the calls to _setup as I suggested (and
then make it use that group name when adding things to ZSL_COLORS, of
Hrm, maybe we should admit this and use the group name instead of the
tag when looking up list-colors.
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by: