Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: _oldlist and automatic coloring of matched
- X-seq: zsh-workers 27911
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Bug: _oldlist and automatic coloring of matched
- Date: Sun, 25 Apr 2010 22:22:19 +0100
- In-reply-to: <s2x691a5d911004241035ra479cf4du2d02c2244f143c7f@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20100423222858.GC11609@xxxxxxxxx> <s2x691a5d911004241035ra479cf4du2d02c2244f143c7f@xxxxxxxxxxxxxx>
On Sat, 24 Apr 2010 10:35:06 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Fri, Apr 23, 2010 at 3:28 PM, Julius Plenz <julius@xxxxxxxxx> 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@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author