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

Re: [BUG] region_highlight+=( "$start $end standout" ) doesn't work as expected



> Could the problem be fixed, .. ASAP?

I won't be working on this, but I can give some poiners.

You'll need to look in Src/Zle/zle_refresh.c.  You'll see the
region_highlights variable that contains the information.  There are 4
special regions at the start --- see definition of
N_SPECIAL_HIGHLIGHTS.

There are two key points in turning this information into the output.
One is following the comment "Calculate attribute based on region". 
That's where the information gets encoded into the array of characters
to output, which remembers the attributes associated with the character
based on the last thing to change.

The other is inside settextattributes(), where the appropriate sequences
are output.  That's called at various points during the output, but only
if we detect something has changed in them: zwcputc() is the key
location, but you'll see there are others.

The big issue here is that the shell is turning structured information
into a sequence to output --- it's not outputing a character with
particular attributes at a particular location, it's outputing a stream
consisting of a mix of characters and instructions to change
attributes.  So, for example, if two changes logically occur at the some
point which one actually happens is, while supposedly well-defined
(can't remember the rules but I think they're documented, not
necessarily in full detail), is bug-prone.

If you're problem has got to do with line wrap, that's even worse ---
as widely noted in earlier threads, you're then fighting various
terminals and their definitions, too.

Good luck.

pws



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