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

Re: [BUG] General 256 colors bug – zle_highlight / fg_start_code, etc. is not respected (was: highlight test cases)



On Fri, 7 Dec 2018 at 02:55, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> So again no CDE|3...|, but raw ^[38;5;196m. So this is a general Zsh
> bug, not near-color bug, as zsh/near-color module isn't loaded in this
> test, it's only the 256 code "fg=196" that is being used.

Following Daniel's request of a minimal test case that makes the
problem visible:

widget() { zle_highlight=( fg_start_code:"CDE|3" fg_end_code:"|"
bg_start_code:"BCDE|4" bg_end_code:"|" ); BUFFER="true word2 word3";
region_highlight=( "0 4 fg=196" ); }
zle -N widget
bindkey '^T' widget

And after pasting and accepting in zsh -f, press Ctrl-T. You will see
red word "true" followed by "CDE|39|" and the other words, i.e.

% trueCDE|39| word2 word3

(the true is in red, but cannot visualize this in email). So:
zsh_highlight was ignored for 256 color code, only code ^[[39m has
been processed by zle_highlight, while the fg=196 code was output
unprocessed, i.e. as ^[[38;5;196m.

Could the problem be fixed, .. ASAP? It collides with my work of
providing X04 tests and is a blocker for making a new Zsh
release. I think Oliver touched the responsible code lately, as for
true-color (not 256 color, with or withoutzsh/nearcolor), the
zle_highlight processing works, i.e. I'm getting, e.g.:

0m27m24mCDE|38;2;0;204;0|tCDE|38;2;204;0;0|rCDE|39|CDE|38;2;0;204;0|ueCDE|39|

in an X04 test case. So all 24-bit escape codes are nicely covered
with CDE| etc. things from zle_highlight. So maybe it seems that the
"get text representation from already processed entries in
region_highlight" that Olivier did is used also here.

So basically 256-color doesn't obey zle_highlight, while first 8/16
colors and TrueColor are obeying it.

--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org



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