Benjamin Peter wrote: [...] > (%:~)- (set -x; colors;) 2>&1 | cat -v > +/bin/zsh:3> colors > +colors:4> typeset -Ag color colour > +colors:6> color=( 00 none 01 bold 02 faint 22 normal 03 standout 23 > no-standout 04 underline 24 no-underline 05 blink 25 no-blink 07 > reverse 27 no-reverse 08 conceal 28 no-conceal 30 black 40 bg-black 31 > red 41 bg-red 32 green 42 bg-green 33 yellow 43 bg-yellow 34 blue 44 > bg-blue 35 magenta 45 bg-magenta 36 cyan 46 bg-cyan 37 white 47 > bg-white 39 default 49 bg-default )
Initialisation looks good. > +colors:74> local k > +colors:75> k=bg-blue > +colors:75> color[${color[$k]}]=bg-blue This looks wrong already. The actual code is this: for k in ${(k)color}; do color[${color[$k]}]=$k done So this should iterate over all keys in `$color'. Those should be 00, 01, 02, etc. And not even "bg-blue", which is the *value* to the key 44. > +colors:79> k=30 > +colors:79> color[fg-${color[$k]}]=30 > +colors:79> k=31 > +colors:79> color[fg-${color[$k]}]=31 > +colors:79> k=32 > +colors:79> color[fg-${color[$k]}]=32 > +colors:79> k=33 > +colors:79> color[fg-${color[$k]}]=33 > +colors:79> k=34 > +colors:79> color[fg-${color[$k]}]=34 > +colors:79> k=35 > +colors:79> color[fg-${color[$k]}]=35 > +colors:79> k=36 > +colors:79> color[fg-${color[$k]}]=36 > +colors:79> k=37 > +colors:79> color[fg-${color[$k]}]=37 > +colors:79> k=39 > +colors:79> color[fg-${color[$k]}]=39 This is this loop: for k in ${color[(I)3?]}; do color[fg-${color[$k]}]=$k done Looks good. > +colors:83> color[grey]='' > +colors:84> color[fg-grey]='' > +colors:85> color[bg-grey]='' Just a few assignments. After this, the colours= assignment follows, which is missing in here as expected, since you commented to out.. > +colors:95> local 'lc=^[[' 'rc=m' > +colors:97> typeset -Hg reset_color bold_color > +colors:98> reset_color='^[[m' > +colors:99> bold_color='^[[m' > +colors:103> typeset -AHg fg fg_bold fg_no_bold A few more assignments. [...] What follows is the construction of the `$fg[]' and `$bg[]' associative arrays (and friends). It looks correct but a little short, which I blame on the first loop from above screwing up. My suspicion is that this is an effect of an option. Could it be, that you're setting the `ksharrays' option? I strongly suspect that you do. [[ -o ksharrays ]] && print option set || print option unset If you do, a workaround would be to set the ksharrays option *after* you're running the `colors' function. A fix would be to either locally unset the `ksharrays' option in this function, or to use an array expansion, that works independently of this particular setting. Could you try if this patch fixes the issue even if `ksharrays' is set? diff --git a/Functions/Misc/colors b/Functions/Misc/colors index bef93c8..dfa169a 100644 --- a/Functions/Misc/colors +++ b/Functions/Misc/colors @@ -72,7 +72,7 @@ color=( # but it's clearer to include them all both ways. local k -for k in ${(k)color}; do color[${color[$k]}]=$k; done +for k in "${(k)color[@]}"; do color[${color[$k]}]=$k; done # Add "fg-" keys for all the text colors, for clarity. @@ -86,7 +86,7 @@ color[bg-grey]=${color[bg-black]} # Assistance for the color-blind. -colour=(${(kv)color}) # A case where ksh namerefs would be useful ... +colour=( "${(kv)color[@]}" ) # A case where ksh namerefs would be useful ... # The following are terminal escape sequences used by colored prompt themes. I think that should fix the issue. However, the simpler fix is to just say this in the first line of code in the `colors' file: setopt localoption no_ksharrays If you could verify my suspicion, that'd be swell. Regards, Frank -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org