Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: prevent some lines directly coming from the history from being executed
- X-seq: zsh-users 27802
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: prevent some lines directly coming from the history from being executed
- Date: Thu, 26 May 2022 16:36:02 +0200
- Archived-at: <https://zsh.org/users/27802>
- In-reply-to: <CAH+w=7YnEiZEQpqACbYQEUzQ0SskZYcvmq1uvhsuvHNvoYstNw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- References: <20220524154738.GA35284@cventin.lip.ens-lyon.fr> <CAH+w=7ZXO12Gb7LFGT0US=M=xBdi1XHoMU7t7n4=cbov+EKcNA@mail.gmail.com> <20220525025403.GA97860@zira.vinc17.org> <CAH+w=7apO+iFprYnGwTbrrV-jS7WEv1m7uok7NgXpoXGqS_F8w@mail.gmail.com> <20220525084920.GB97860@zira.vinc17.org> <CAH+w=7YnEiZEQpqACbYQEUzQ0SskZYcvmq1uvhsuvHNvoYstNw@mail.gmail.com>
On 2022-05-25 18:25:40 -0700, Bart Schaefer wrote:
> On Wed, May 25, 2022 at 1:49 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> > There are some display issues in some cases due to the "Confirm"...
>
> Probably the same underlying issue as I recently reported with zle -M ... but
> read -q confirm$'?\nConfirm? '
> might work more consistently.
Yes, it seems so.
> > Instead, if the condition is met, is it possible to remain in ZLE
> > with the current buffer, as if I didn't do accept-line?
> [...]
> > Or perhaps I could change the bindings to use a wrapper around
> > accept-line (ditto for accept-line-and-down-history).
>
> Yes, this could be done as a wrapper. If you want to try to keep it
> in zle-line-finish, replace
> ... || BUFFER=""
> with
> ... || { print -z $BUFFER && BUFFER="" }
> or similar.
But this has the effect to duplicate the line in the terminal.
For instance:
zira:~> echo foo <16:29:05
zira:~> echo foo <16:29:09
foo
> > zle -A accept-line real-accept-line
>
> There's the built-in ".accept-line" widget for this sort of thing, so
> you don't have to create a new alias.
Is this documented?
When searching the man pages, I could find only one place where
such a built-in is used: in the example for recursive-edit.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author