zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: fix colouring in prompt completion
Date: Wed, 10 Jun 2020 01:59:55 +0200	[thread overview]
Message-ID: <5590-1591747195.005165@UC92.OfOa.hbm2> (raw)
In-Reply-To: <5590-1591747195.005165.ref@UC92.OfOa.hbm2>

The completion sorting option changes mean that we're adding -o nosort
-J group instead of -V which breaks extracting the group from $expl.
Also, using ${(%)...} avoids the fork with $(print -P ...) though I'm
not certain the quoting of braces is good with all option combinations.

Oliver

diff --git a/Completion/Zsh/Type/_ps1234 b/Completion/Zsh/Type/_ps1234
index cf1982219..0ea2cdda9 100644
--- a/Completion/Zsh/Type/_ps1234
+++ b/Completion/Zsh/Type/_ps1234
@@ -38,7 +38,7 @@ if compset -P '%[FK]'; then
   )
 
   _description -V ansi-colors expl 'ansi color'
-  grp="$expl[expl[(i)-V]+1]"
+  grp="$expl[expl[(i)-J]+1]"
   print -v ccol -f "($grp)=%s=%s" ${(kv)ansi}
   _comp_colors+=( $ccol )
   compadd "$expl[@]" $suf $pre -k ansi && ret=0
@@ -48,10 +48,10 @@ if compset -P '%[FK]'; then
     (( cols = $terminfo[colors] - 1 ))
     (( cols = cols > 255 ? 255 : cols ))
     _description -V terminal-colors expl 'terminal color'
-    grp="$expl[expl[(i)-V]+1]"
+    grp="$expl[expl[(i)-J]+1]"
     compadd "$expl[@]" $suf $pre {0..$cols}
     for c in {0..$cols}; do
-      _comp_colors+=( "($grp)=${c}=${${$(print -P "%F{$c}")#?\[}%m}" )
+      _comp_colors+=( "($grp)=${c}=${${${(%):-%F{$c\}}#?\[}%m}" )
     done
   else
     _message -e terminal-colors "number"

           reply	other threads:[~2020-06-10  0:00 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <5590-1591747195.005165.ref@UC92.OfOa.hbm2>]

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=5590-1591747195.005165@UC92.OfOa.hbm2 \
    --to=okiddle@yahoo.co.uk \
    --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).