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

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



On Fri, 7 Dec 2018 at 08:53, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> Could you post a self-contained reproduction recipe for the bug?  By
> that I mean something that we can copy-paste from the email into a fresh
> 'zsh -f' instance and observe the bug.

It's hard because it only happens when using F-Sy-H (and also Z-Sy-H
as one user reported – he reported lack of highlighting of selected
rightmost character to occur in both plugins, I'm assuming changing +=
to = in Z-Sy-H's last command in  _zsh_highlight_apply_zle_highlight
will yield the same results – the boundary, rightmost character will
get highlighted).

I did dumping of region_highlight and there are only 2 entries, fg=196
and the standout, like expected. And yet without "fg=196 "rh-entry the
standaout spans on rightmost char. Not spanning on it when the
preceding "fg=196" entry exists.

But more, the F-Sy-H (and probably also Z-Sy-H) doesn't have right to
work at all, because the indices are WRONGLY calculated. The patch
that is pushed to F-Sy-H does:

-min=$CURSOR max=$MARK
+min=$CURSOR max=$(( MARK + 1 ))

because when rightmost character is a MARK and CURSOR goes on the
left, then the index MUST be 1-higher for the highlight to appear on
rightmost char. So all problems are solved by correct indices
computing, and a puzzle why it works with wrong indices, if there is
no other entry in r_highlight, and only under F-Sy-H.

The commit:
https://github.com/zdharma/fast-syntax-highlighting/commit/8cc7f489ae378606091dbd84345c18c8f7292f0f
-- 
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