zsh-users
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Zsh Users <zsh-users@zsh.org>, ericdfreese@gmail.com
Subject: Re: emulate bash key bindings
Date: Fri, 10 Jan 2020 18:35:26 +0100	[thread overview]
Message-ID: <CAN=4vMr0OaUMOsW41p1oyMPKJ40KKMP20=uQQ-_jTLLLU-ryPg@mail.gmail.com> (raw)
In-Reply-To: <20200110170639.uvdidtgwswjqanhh@tarpaulin.shahaf.local2>

On Fri, Jan 10, 2020 at 6:06 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> [sorry for the late answer]

No worries. Thanks for replying.

Let me try to describe what's going on. I've only skimmed through the
implementations of these plugins, so please take it with a grain of
salt.

When zsh-syntax-highlighting is used together with
zsh-autosuggestions, everything works correctly as long as every
widget in which zsh-syntax-highlighting applies its highlighting is
wrapped by zsh-autosuggestions. This is necessary because
zsh-syntax-highlighting removes highlighting from POSTDISPLAY. There
are two situations where the combination of zsh-syntax-highlighting
and zsh-autosuggestions results in missing POSTDISPLAY highlighting:

1. zsh-syntax-highlighting is applying highlighting in a widget that
zsh-autosuggestions does not wrap.
2. zsh-syntax-highlighting has wrapped a widget *after*
zsh-autosuggestions wrapped it.

https://github.com/zsh-users/zsh-syntax-highlighting/issues/579
happens because of (1). Specifically, zsh-syntax-highlighting is
applying highlighting in zle-line-pre-redraw, which
zsh-autosuggestions doesn't wrap. zsh-autosuggestions doesn't wrap
widgets whose names match patterns from
ZSH_AUTOSUGGEST_IGNORE_WIDGETS. The default value of this parameter
includes pattern `zle-*`.

In order to use zsh-autosuggestions together with feature/redrawhook
branch of zsh-syntax-highlighting users need to override
ZSH_AUTOSUGGEST_IGNORE_WIDGETS so that it does not contain a pattern
against which `zle-line-pre-redraw` can match.

This may be a viable course of action even though it'll likely have
very high cost for the users of these plugins. If I may make a
suggestion, perhaps zsh-syntax-highlighting shouldn't remove
highlighting from POSTDISPLAY? zsh-autosuggestions owns POSTDISPLAY
area while zsh-syntax-highlighting owns BUFFER. zsh-autosuggestions
doesn't touch highlighting of BUFFER, which allows it to peacefully
coexist with syntax highlighting plugins. If zsh-syntax-highlighting
did the same w.r.t. POSTDISPLAY highlighting, there would be no
widget-wrapping-order dependencies and feature/redrawhook wouldn't
introduce breaking changes for users who rely on both of these great
plugins.

Just my 2 cents. I hope it makes at least some sense.


Roman.

  reply	other threads:[~2020-01-10 17:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200107184011eucas1p241073778b2cdd5bf7e94b43851273d49@eucas1p2.samsung.com>
2020-01-07 18:38 ` Andrey Butirsky
2020-01-08  2:26   ` Sebastian Gniazdowski
2020-01-08  2:37     ` Andrey Butirsky
2020-01-08  4:26       ` dana
2020-01-08  9:06       ` Mikael Magnusson
2020-01-08 10:00   ` Peter Stephenson
2020-01-08 21:55     ` Andrey Butirsky
2020-01-08 22:03       ` Roman Perepelitsa
2020-01-08 22:23         ` Daniel Shahaf
2020-01-09  0:05           ` Andrey Butirsky
2020-01-09  8:45             ` Roman Perepelitsa
2020-01-09  9:27               ` Andrey
2020-01-09 10:44                 ` Roman Perepelitsa
2020-01-09 11:03           ` Roman Perepelitsa
2020-01-10 17:06             ` Daniel Shahaf
2020-01-10 17:35               ` Roman Perepelitsa [this message]
2020-01-10 18:09                 ` z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings) Daniel Shahaf
2020-01-10 18:14                   ` Roman Perepelitsa
2020-01-10 18:29                     ` Daniel Shahaf
2020-01-10 18:43                       ` Roman Perepelitsa
2020-01-10 19:14                         ` Daniel Shahaf
2020-01-10 22:42                         ` Sebastian Gniazdowski
2020-01-10 22:54                           ` Roman Perepelitsa
2020-01-10 23:46                             ` Sebastian Gniazdowski
2020-01-11 14:30                               ` Roman Perepelitsa
2020-01-12  2:42                                 ` Sebastian Gniazdowski
2020-01-12  2:47                                   ` Sebastian Gniazdowski
2020-01-09 14:18     ` emulate bash key bindings Andrey Butirsky
2020-01-09 14:29       ` Peter Stephenson
2020-01-10  0:46         ` Andrey Butirsky
2020-01-10  9:51           ` Peter Stephenson
2020-01-10 10:58             ` Peter Stephenson
2020-01-10 11:07               ` Peter Stephenson
2020-01-10 11:47               ` Mikael Magnusson
2020-01-10 14:00               ` Andrey Butirsky

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='CAN=4vMr0OaUMOsW41p1oyMPKJ40KKMP20=uQQ-_jTLLLU-ryPg@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=ericdfreese@gmail.com \
    --cc=zsh-users@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).