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

Re: [PATCH] Make 256 color codes be based on zle_highlight array, not on termcap



Sebastian Gniazdowski wrote on Sat, Dec 08, 2018 at 23:04:33 +0100:
> Is the patch acceptable? I imagine someone might suspect there exists
> a terminal that uses escape codes for first 8 colors, but some other
> kind of codes, collected in termcap, for remaining 248 colors. Can
> this be considered impossible to accept the patch?

Might someone out there have a terminal whereunder the sequence ESC 8 ; 5 ; <number>
doesn't change the foreground color, but does something else?

> BTW. I've made X04 zle tests more rock-solid, because the debug prints
> I added to track the 256-color/zle_highlight issue were slowing down
> Zle, and a rare phenomenon (not occurred from the time I've simplified
> Zle, disabled the echoing of input text) became very often: Ctrl-D was
> appearing too quickly after Ctrl-A. A sleep of 333 ms made the problem
> go away, and I think the issue is solved, and Zle tests are quite rock
> solid now.

That's great.

> commit 5dda212b3be3f1f12ad31e3d6543d367f987ee55
> Author: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
> Date:   Sat Dec 8 22:42:49 2018 +0100
> 
>     Instead of using termcap, 256-colours are based on zle_highlight entries
>     
>     Following code snippet performs the conversion of colour number to the
>     code to be emitted to terminal (the example shows foreground color
>     handling):
>         ...
>         strcpy(colseq_buf, fg_bg_sequences[fg_bg].start);
>         ...
>         } else if (colour > 7 && colour <= 255) {
>             ptr += sprintf(ptr, "8;5;%d", colour);
>         ...

For future reference, it's better to post `git format-patch` output
than `git show` output because the former can be applied easily (with
git-am(1)) but the latter can't.

Cheers,

Daniel



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