zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] region_highlight+=( "$start $end standout" ) doesn't work as expected
Date: Fri, 7 Dec 2018 16:04:22 +0100	[thread overview]
Message-ID: <CAKc7PVChj1t0sP1TesDPzuMo_hUR2e_nwWugXVoxb1S=dYROhw@mail.gmail.com> (raw)
In-Reply-To: <1544168721.2479259.1601798392.35689542@webmail.messagingengine.com>

On Fri, 7 Dec 2018 at 08:53, Daniel Shahaf <d.s@daniel.shahaf.name> 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

  reply	other threads:[~2018-12-07 15:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06  7:03 Sebastian Gniazdowski
2018-12-07  1:42 ` Sebastian Gniazdowski
2018-12-07  7:45   ` Daniel Shahaf
2018-12-07 15:04     ` Sebastian Gniazdowski [this message]
2018-12-09 18:49       ` Peter Stephenson
2018-12-09 19:20         ` Sebastian Gniazdowski
2018-12-09 19:48           ` Peter Stephenson
2018-12-09 20:19             ` Sebastian Gniazdowski
2018-12-09 20:56               ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKc7PVChj1t0sP1TesDPzuMo_hUR2e_nwWugXVoxb1S=dYROhw@mail.gmail.com' \
    --to=sgniazdowski@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).