zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: How can Zle -U interfere with zsh-syntax-highlighting?
Date: Sun, 15 May 2016 04:13:21 -0700	[thread overview]
Message-ID: <CAH+w=7b7g-g7JmFvrgR4ezWz7CrVZnXVrV+u9iOitX0H0y_pVQ@mail.gmail.com> (raw)
In-Reply-To: <CAKc7PVCZhyjPqzgPSrKOUs=+Qp5m_yELs2uEAwuCQYZXDKkxUg@mail.gmail.com>

On Sat, May 14, 2016 at 2:07 PM, Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
> Below is a widget that outputs long sophisticated string with zle -U:
>
[...]
>
> With z-sy-h enabled, it takes 4 seconds to appear after pressing
> Ctrl-T. Pasting the same text is instant and correct (i.e.
> highlighting works). What can be happening?

This (line 73-74 in current z-sy-h.zsh):

# Do not highlight if there are pending inputs (copy/paste).
[[ $PENDING -gt 0 ]] && return $ret

"zle -U" feeds the input back to zle one character at a time but does
not set PENDING, so I suspect the highlight is being recaculated after
every character.  I suppose it might make sense for "zle -U" to
pretend to be actual input even to the extent of PENDING, but it
currently does not.

This also explains why immediately typing something else speeds things
up:  Highlighting pauses until that character is consumed.

> Is there some alternative to Zle -U?

Other than just LBUFFER+="long text here", no.  If you want the other
effects of zle -U (i.e., that each character is interpreted as if it
had been typed) then there is no alternative.


  parent reply	other threads:[~2016-05-15 11:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-14 21:07 Sebastian Gniazdowski
2016-05-14 21:23 ` Sebastian Gniazdowski
2016-05-15 11:13 ` Bart Schaefer [this message]
2016-05-15 15:24   ` Sebastian Gniazdowski
2016-05-15 15:24     ` Sebastian Gniazdowski
2016-05-15 15:37       ` Mikael Magnusson
2016-05-15 15:41     ` Sebastian Gniazdowski
2016-05-18 17:53       ` Sebastian Gniazdowski
2016-05-19 21:22   ` Daniel Shahaf
2016-05-25  6:14     ` Sebastian Gniazdowski

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='CAH+w=7b7g-g7JmFvrgR4ezWz7CrVZnXVrV+u9iOitX0H0y_pVQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --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).