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

Re: [BUG?] If true-color is used, overlapping colors do not work



A simpler way to observe this:

% zsh -fi
% rh_widget() { BUFFER="true"; region_highlight+=( "0 4 fg=#00cc00" ); rh2; };
rh2() { region_highlight+=( "1 2 fg=#cc0000" ); }
zle -N rh_widget
bindkey "\C-a" rh_widget
% <press ctrl-a>
On Wed, 7 Nov 2018 at 14:19, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> Hello
> The last test from the attached ztst reveals this. Before-last test overlapping colors with standard fg=green/fg=red symbols. Result is a word "true" with "r" in red the rest in green. You can see the colors by doing cat /tmp/output.
>
> With true color, I get:
> --- /tmp/zsh.ztst.77121/ztst.out    2018-11-07 14:11:51.000000000 +0100
> +++ /tmp/zsh.ztst.77121/ztst.tout    2018-11-07 14:11:51.000000000 +0100
> @@ -2,5 +2,5 @@
>  rh2() { region_highlight+=( "1 2 fg=#cc0000" ); }
>  zle -N rh_widget
>  bindkey "\C-a" rh_widget
> -0m32mt31mr39m32mue39m
> +0mt38;2;204;0;0mr39mue
>
> The minus-line is not yet updated, inherited from basic 8-colors case (which is working and overlapped colors can be observed in the minus-line). But look at the plus-line. It doesn't emit any color for "t", only true-color red for "r", and then nothing for "ue".
>
> With zsh/nearcolor loaded (test code pasted at the end of this email), colors are correctly overlapped:
>
> --- /tmp/zsh.ztst.76836/ztst.out    2018-11-07 14:09:32.000000000 +0100
> +++ /tmp/zsh.ztst.76836/ztst.tout    2018-11-07 14:09:32.000000000 +0100
> @@ -3,5 +3,5 @@
>  rh2() { region_highlight+=( "1 2 fg=#cc0000" ); }
>  zle -N rh_widget
>  bindkey "\C-a" rh_widget
> -0m32mt31mr39m32mue39m
> +0m38;5;40mt38;5;160mr39m38;5;40mue39m
>
> cat /tmp/output confirms this.
>
> zsh/nearcolor test case:
>
>   zpty_start
>   zpty_input 'zmodload zsh/nearcolor'
>   zpty_input 'rh_widget() { BUFFER="true"; region_highlight+=( "0 4 fg=#00cc00" ); rh2; }'
>   zpty_input 'rh2() { region_highlight+=( "1 2 fg=#cc0000" ); }' # `r' in red; the above line would be too long
>   zpty_input 'zle -N rh_widget'
>   zpty_input 'bindkey "\C-a" rh_widget'
>   zpty_input $'\C-a'
>   zpty_line 5   # 3 lines echoed back + 3 empty lines (zpty bug)
>   zpty_line 1 p
>   zpty_stop
> 0:overlapping region_highlight with true-color
> >zmodload zsh/nearcolor
> >rh_widget() { BUFFER="true"; region_highlight+=( "0 4 fg=#00cc00" ); rh2; }
> >rh2() { region_highlight+=( "1 2 fg=#cc0000" ); }
> >zle -N rh_widget
> >bindkey "\C-a" rh_widget
> >0m32mt31mr39m32mue39m
> >exit
>
> --
> Sebastian Gniazdowski
> News: https://twitter.com/ZdharmaI
> IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
> Blog: http://zdharma.org



-- 
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