zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: region_highlight cancels styles set in zle_highlight
Date: Sat, 5 Sep 2015 10:44:49 +0000	[thread overview]
Message-ID: <20150905104449.GB1895@tarsus.local2> (raw)

How do $zle_highlight and $region_highlight interact?  Which one takes
precedence if a certain byte range is covered by both?

(This came up in [1], which contains observations but no discussion.)

Empirically:

- if both $zle_highlight[region] and $region_highlight apply to a certain
  byte range, then that byte range is highlighted according to the
  former, only:

    bindkey -v
    zle_highlight=( region:underline )
    f() { region_highlight=("0 10 fg=red") }; zle -N f; bindkey -a ^T f
    echo foo bar<Esc><^T>v0
    [the 'echo foo bar' is red but not underlined]

- if both $zle_highlight[special] and $region_highlight apply to a certain
  byte, then both highlightings are applied "on top of" each other:

    zle_highlight=( special:underline )     
    f() { region_highlight=("0 10 fg=red") }; zle -N f; bindkey ^T f
    echo ^T bar «invoke f»
    [the ^T is red and underlined]
  
How does this work, in general?  When does zle merge the settings from
the two arrays, and when does one array override the other?

Thanks,

Daniel
(Background: zsh-syntax-highlighting wants the zle_highlight[region]
highlighting to be applied "on top of" the syntax highlighting [2]; the
workaround [3] works with current zle behaviour of "region_highlight
overrides zle_highlight[region]".)

[1] http://www.zsh.org/cgi-bin/mla/redirect?WORKERNUMBER=29425
    Subject: region_highlight cancels styles set in zle_highlight
[2] https://github.com/zsh-users/zsh-syntax-highlighting/issues/165
[3] https://github.com/jimmijj/zsh-syntax-highlighting/commit/ece762e81798bc4448bf17f68a4792d1117dc032


             reply	other threads:[~2015-09-05 10:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-05 10:44 Daniel Shahaf [this message]
2015-09-06 17:22 ` Peter Stephenson
2015-09-07  2:08   ` Daniel Shahaf
2015-09-07  8:48     ` Peter Stephenson
2015-09-07 21:21       ` Daniel Shahaf
  -- strict thread matches above, loose matches on Subject: below --
2011-06-01 15:57 Mikael Magnusson
2011-06-01 15:59 ` Mikael Magnusson

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=20150905104449.GB1895@tarsus.local2 \
    --to=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).