Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

color



Bart, all:

Trying to get  rid of the calls to typeset, I'm experimenting with variations of the second line here:

...

VARIABLES+="${parameters[$1]} $( typeset -m -- ${(b)1} )"
VARIABLES+="${parameters[$1]} $1=${(Pq+)1}"

...

... there are only very minor differences except in one case and that's 'color':

2 /aWorking/Zsh/Source/Wk 0 $ . v; v _v_a* color

H     color = ( [00]=none [01]=bold [02]=faint [03]=standout [04]=underline [05]=blink  ... H     color = 'none normal bg-blue 31 bold no-standout bg-magenta faint no-underline bg ... Al    _v_abrev = ( sed -re 's/(^[^ ]*) ([^=]*)=(.*)/\1  \2 = \3/' -e 's/integer[ |-]/I/ ... Al    _v_abrev = 'sed -re s/(^[^ ]*) ([^=]*)=(.*)/\1  \2 = \3/ -e s/integer[ |-]/I/ -e  ...

... the second line doesn't show the parentheses around arrays and the way of quoting the 'sed' string is slightly different, but no matter.  However the 'color' param prints completely differently, and no variation on the second line changes that.  Also, the color/colour param seems to be the only variable that has this issue.  No other param shows what look like indexes "[00]" that way.  All printing methods I know of besides typeset -m show the second version of 'color' but it looks plain wrong, the typeset version is 'obviously' correct.   The untruncated 'color':


3 /aWorking/Zsh/Source/Wk 2 $ print -r $color
none normal bg-blue 31 bold no-standout bg-magenta faint no-underline bg-cyan standout no-blink bg-white underline 33 41 01 blink no-reverse bg-default 27 no-conceal reverse conceal 30 31 08 39 02 32 24 45 35 05 34 30 39 47 black 23 red green 43 yellow 36 blue magenta 37 cyan 03 white 44 35 default 40 28 07 46 04 33 37 40 22 34 42 00 30 30 25 49 bg-black 36 32 bg-red bg-green bg-yellow

... completely strange.  Why is 'color' unique in this way?  Can I do anything about it?  Without 'typeset' the function runs 4X faster, so I prefer the second line above if possible.  Even simply as a logic problem  can't see how the two displays of 'color' are related but of course they must be.







Messages sorted by: Reverse Date, Date, Thread, Author