help / color / mirror / code / Atom feed
From: Marlon Richert <marlon.richert@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Bug: Callback to widget set with `zle -Fw <widget>` shouldn't change $LASTWIDGET
Date: Thu, 17 Nov 2022 15:04:50 +0200	[thread overview]
Message-ID: <CAHLkEDuo112DieG6ur_M0giV4UXVTjKRLuzrpUchcoj6V_LEtA@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7ZpQ=GVCbOHfQwB5m98CdK6fcb2PTMxSRn8qijVCrX5kg@mail.gmail.com>

The -w in `zle -Fw arg` is not the inverse of the -w in `zle -w arg`.
It has a different purpose:
* In `zle -F callback`, callback is a function and gets called as such.
* In `zle -Fw callback`, callback is a widget and gets called as such.

The latter form is necessary if you want to be able to call other ZLE
widgets from the callback or access other ZLE functionality. You
cannot do that with the first form.

It's not the "inverted meaning" here that is the bug. `zle -F` (with
or without -w) just shouldn't ever change $LASTWIDGET in the first
place. It breaks a lot of existing widget functions and there is no
possible workaround.

On Wed, Nov 16, 2022 at 8:25 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Wed, Nov 16, 2022 at 7:08 AM Marlon Richert <marlon.richert@gmail.com> wrote:
> >
> > Currently, when the ZLE calls a widget set with `zle -Fw <widget>`,
> > this changes the value of $LASTWIDGET.
> Hrm, normally (running "zle WIDGET ..." explicitly) this would be
> skipped (unless "zle WIDGET -w ...").  Too bad -w was overloaded in
> this way.  It's not technically overloading because it's used in
> different contexts, but mnemonically at least it could be confusing
> that "zle -Fw FD WIDGET" and "zle WIDGET -w" would seem to have
> inverted meanings of -w if we were to change the default behavior of
> -F.
> Of course it's also "-Fw" as a single "option", not "-F -w", so we
> can't even do something like "zle -F +w" to indicate the desired
> behavior.

  reply	other threads:[~2022-11-17 13:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 15:06 Marlon Richert
2022-11-16 18:24 ` Bart Schaefer
2022-11-17 13:04   ` Marlon Richert [this message]
2022-11-17 13:28     ` Roman Perepelitsa
2022-11-17 16:18     ` Bart Schaefer
2023-01-11  7:45       ` Marlon Richert
2023-01-17  0:01 ` [PATCH] " Bart Schaefer
2023-01-17  9:22   ` Peter Stephenson
2023-01-17 18:00     ` Bart Schaefer
2023-07-16 10:28       ` dana
2023-07-17  8:42         ` Peter Stephenson
2023-07-17 15:17         ` Bart Schaefer
2023-07-17 15:52           ` dana
2023-07-17 15:57             ` Bart Schaefer
2023-07-17 16:57               ` Bart Schaefer
2023-07-20  4:01                 ` dana
2023-07-20  4:25                   ` Bart Schaefer

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:

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

  git send-email \
    --in-reply-to=CAHLkEDuo112DieG6ur_M0giV4UXVTjKRLuzrpUchcoj6V_LEtA@mail.gmail.com \
    --to=marlon.richert@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \


* 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


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