Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] With CORRECT_ALL, an interrupted correct puts a truncated entry in history



On 2023-12-17 11:37:12 -0800, Bart Schaefer wrote:
> This is another reason 'a' doesn't throw away the history -- you could
> lose many lines of typing above the point of canceling the correction.

There could have been a special history file for aborts. Or perhaps
the history file could have some flag for commands that are in the
history but have never been run.

Note that in many cases when I want to abort is when the command
already comes from the history. So there's no point saving it again
in general.

> > > > Or just use 'e', then immediately put the command in the history
> > > > without running it. Is there a zle widget for that? I would find
> > > > this useful even when there are no spelling corrections.
> > >
> > > Correction is not itself a ZLE action -- it happens after ZLE has
> > > returned control to the parser, and works even if ZLE is disabled.
> > > So there's no widget to fiddle with it.
> >
> > But what matters is that after 'e', one is in ZLE.
[corrected a typo]

> You asked if there was a widget to immediately put the command in the
> history after 'e'.  There's not a widget to do all of that, because
> there's not a widget triggered on 'e'.

What I intended to mean was just a widget that puts a command in the
history without running it. This is unrelated to corrections (see the
"I would find this useful even when there are no spelling corrections"
sentence above). The point would just be to save what has been typed
and recall this later.

In general, when I type 'e', I just want to edit the command.

> That said ... attached is an actual ZLE implementation of correctall.

I would be much more interested in a "correctnone": there are some
cases where one knows that there is nothing to correct, e.g. because
the arguments do not correspond to existing filenames (they could be
the result of all-matches, for instance).

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