From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: Bug: _oldlist and automatic coloring of matched
Date: Sun, 25 Apr 2010 22:22:19 +0100 [thread overview]
Message-ID: <20100425222219.354a52e8@pws-pc> (raw)
In-Reply-To: <s2x691a5d911004241035ra479cf4du2d02c2244f143c7f@mail.gmail.com>
On Sat, 24 Apr 2010 10:35:06 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Fri, Apr 23, 2010 at 3:28 PM, Julius Plenz <julius@plenz.com> wrote:
> >
> > autoload -U compinit && compinit
> > zmodload -i zsh/complist
> > zstyle ':completion:*' completer _oldlist _complete
> > zstyle ':completion:*' menu select select=long-list
> >
> > If you hit Tab the first time, the listing of filenames is not
> > colored. But once you hit Tab again (and the _oldlist completer comes
> > into play) suddenly some matches are colored.
>
> This is actually coming from _main_complete, here:
>
> if [[ "$compstate[old_list]" = keep ]]; then
> ZLS_COLORS="$_saved_colors"
> elif (( $#_comp_colors )); then
> ZLS_COLORS="${(j.:.)_comp_colors}"
> else
> unset ZLS_COLORS
> fi
>
> I guess there should be a second test that $_saved_colors is non-empty
> before assigning it to ZLS_COLORS ... but I'm not sure that's correct
> either, because we don't know at this point *why* $_saved_colors is
> empty, i.e., whether the value when saved was empty or unset.
Should it be something like this?
Index: Completion/Base/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_main_complete,v
retrieving revision 1.11
diff -p -u -r1.11 _main_complete
--- Completion/Base/Core/_main_complete 1 Apr 2009 10:57:12 -0000 1.11
+++ Completion/Base/Core/_main_complete 25 Apr 2010 21:21:25 -0000
@@ -30,7 +30,8 @@ local func funcs ret=1 tmp _compskip for
_saved_lastprompt="${compstate[last_prompt]}" \
_saved_list="${compstate[list]}" \
_saved_insert="${compstate[insert]}" \
- _saved_colors="$ZLS_COLORS"
+ _saved_colors="$ZLS_COLORS" \
+ _saved_colors_set=${+ZLS_COLORS}
# _precommand sets this to indicate we are following a precommand modifier
local -a precommands
@@ -325,7 +326,11 @@ fi
compstate[list]="${compstate[list]//messages} force"
if [[ "$compstate[old_list]" = keep ]]; then
- ZLS_COLORS="$_saved_colors"
+ if [[ $_saved_colors_set = 1 ]]; then
+ ZLS_COLORS="$_saved_colors"
+ else
+ unset ZLS_COLORS
+ fi
elif (( $#_comp_colors )); then
ZLS_COLORS="${(j.:.)_comp_colors}"
else
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
next prev parent reply other threads:[~2010-04-25 21:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-23 22:28 Julius Plenz
2010-04-24 17:35 ` Bart Schaefer
2010-04-25 21:22 ` Peter Stephenson [this message]
2010-04-26 16:21 ` Bart Schaefer
2010-04-26 17:14 ` 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=20100425222219.354a52e8@pws-pc \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@zsh.org \
/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).