Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Bug: Callback to widget set with `zle -Fw <widget>` shouldn't change $LASTWIDGET
- X-seq: zsh-workers 50981
- From: Marlon Richert <marlon.richert@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Bug: Callback to widget set with `zle -Fw <widget>` shouldn't change $LASTWIDGET
- Date: Wed, 16 Nov 2022 17:06:46 +0200
- Archived-at: <https://zsh.org/workers/50981>
- List-id: <zsh-workers.zsh.org>
Currently, when the ZLE calls a widget set with `zle -Fw <widget>`,
this changes the value of $LASTWIDGET. This in turn breaks several of
the widgets listed in the manual under User Contributions. For
example:
% zsh -f
% autoload -Uz copy-earlier-word
% zle -N copy-earlier-word
% bindkey '\e,' copy-earlier-word
% # Pressing ^[, multiple times at this point successfully cycles
through the current words on the command line.
% handler() { local fd=$1; zle -F $fd; exec {fd}<&- }
% zle-line-pre-redraw() { local fd; exec {fd}< <( print ); zle -Fw $fd handler }
% zle -N handler
% zle -N zle-line-pre-redraw
% # Now ^[, still copies the last word on the line, but can no longer
cycle to previous words when pressed again.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author