zsh-workers
 help / color / Atom feed
* PATCH: fix colouring in prompt completion
       [not found] <5590-1591747195.005165.ref@UC92.OfOa.hbm2>
@ 2020-06-09 23:59 ` Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2020-06-09 23:59 UTC (permalink / raw)
  To: Zsh workers

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"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <5590-1591747195.005165.ref@UC92.OfOa.hbm2>
2020-06-09 23:59 ` PATCH: fix colouring in prompt completion Oliver Kiddle

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git