zsh-workers
 help / color / mirror / code / Atom feed
* zle_highlight and yank
@ 2015-12-08 20:48 Yuri D'Elia
  2015-12-08 21:28 ` Mikael Magnusson
  0 siblings, 1 reply; 4+ messages in thread
From: Yuri D'Elia @ 2015-12-08 20:48 UTC (permalink / raw)
  To: zsh-workers

Yanking text seems to ignore any setting in zle_highlight. This is
confirmed by setting zle_highlight=(none) and seeing that yank still
highlights the text in standout.

I would have expected it to respect the paste: style.

Or maybe it's a good idea that it doesn't, to differentiate between a
terminal paste and a regular one. But then again, I'd like a yank: style
in there.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zle_highlight and yank
  2015-12-08 20:48 zle_highlight and yank Yuri D'Elia
@ 2015-12-08 21:28 ` Mikael Magnusson
  2015-12-08 21:37   ` Yuri D'Elia
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2015-12-08 21:28 UTC (permalink / raw)
  To: Yuri D'Elia; +Cc: zsh workers

On Tue, Dec 8, 2015 at 9:48 PM, Yuri D'Elia <wavexx@thregr.org> wrote:
> Yanking text seems to ignore any setting in zle_highlight. This is
> confirmed by setting zle_highlight=(none) and seeing that yank still
> highlights the text in standout.
>
> I would have expected it to respect the paste: style.
>
> Or maybe it's a good idea that it doesn't, to differentiate between a
> terminal paste and a regular one. But then again, I'd like a yank: style
> in there.

I guess it's a bug that (none) doesn't disable the paste: style, but
you can explicitly put in paste: to disable it if you want, eg
zle_highlight=(none paste:)

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zle_highlight and yank
  2015-12-08 21:28 ` Mikael Magnusson
@ 2015-12-08 21:37   ` Yuri D'Elia
  2015-12-12  8:55     ` Daniel Shahaf
  0 siblings, 1 reply; 4+ messages in thread
From: Yuri D'Elia @ 2015-12-08 21:37 UTC (permalink / raw)
  To: zsh-workers

On 08/12/15 22:28, Mikael Magnusson wrote:
>> I would have expected it to respect the paste: style.
>>
>> Or maybe it's a good idea that it doesn't, to differentiate between a
>> terminal paste and a regular one. But then again, I'd like a yank: style
>> in there.
> 
> I guess it's a bug that (none) doesn't disable the paste: style, but
> you can explicitly put in paste: to disable it if you want, eg
> zle_highlight=(none paste:)

I really only wanted to disable yank highlighting, which I find
distracting since I often know exactly what I just previously cut.

But I do find highlighting for paste generally useful on the other hand.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zle_highlight and yank
  2015-12-08 21:37   ` Yuri D'Elia
@ 2015-12-12  8:55     ` Daniel Shahaf
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2015-12-12  8:55 UTC (permalink / raw)
  To: Yuri D'Elia; +Cc: zsh-workers

Yuri D'Elia wrote on Tue, Dec 08, 2015 at 22:37:36 +0100:
> On 08/12/15 22:28, Mikael Magnusson wrote:
> >> I would have expected it to respect the paste: style.
> >>
> >> Or maybe it's a good idea that it doesn't, to differentiate between a
> >> terminal paste and a regular one. But then again, I'd like a yank: style
> >> in there.
> > 
> > I guess it's a bug that (none) doesn't disable the paste: style, but
> > you can explicitly put in paste: to disable it if you want, eg
> > zle_highlight=(none paste:)
> 
> I really only wanted to disable yank highlighting, which I find
> distracting since I often know exactly what I just previously cut.
> 
> But I do find highlighting for paste generally useful on the other hand.

Try this:

    f() {
      zle .$WIDGET "$@"
      integer start end
      if (( YANK_START > YANK_END )); then
        start=$YANK_END end=$YANK_START
      else
        end=$YANK_END start=$YANK_START
      fi
      region_highlight+=("$start $end bg=blue")
      zle -f 'yank'
    }
    zle -N yank f

You will want to change 'bg=blue' to whatever your default colors are;
for some reason specifying "none" doesn't override the 'standout'
highlighting.

"zle -f" was added in zsh-5.2, for older versions just comment it out.

Cheers,

Daniel

P.S. It'd be nice to have built-in min() and max() math functions..


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-12  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08 20:48 zle_highlight and yank Yuri D'Elia
2015-12-08 21:28 ` Mikael Magnusson
2015-12-08 21:37   ` Yuri D'Elia
2015-12-12  8:55     ` Daniel Shahaf

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).