zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: [BUG] With CORRECT_ALL, an interrupted correct puts a truncated entry in history
Date: Sun, 17 Dec 2023 22:36:11 -0800	[thread overview]
Message-ID: <CAH+w=7aW6YDj7aqkyXXTzTFoKorJT9QCJ5uyEeyXtd7ssYpstg@mail.gmail.com> (raw)
In-Reply-To: <20231218033752.GB3237@zira.vinc17.org>

On Sun, Dec 17, 2023 at 7:37 PM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> There could have been a special history file for aborts.

Time-travel is not a likely solution ...

> Or perhaps
> the history file could have some flag for commands that are in the
> history but have never been run.

That would get rather messy given the existence of shared history and
of "print -s".

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

The widget version from my previous message saves only the $PREBUFFER
on abort.  If you've recalled a multi-line construct from history,
PREBUFFER will be empty.

Presently ^C ends up acting like 'e' because I haven't gotten around
to signal handling yet.

> What I intended to mean was just a widget that puts a command in the
> history without running it.

hist-no-exec() {
  print -s "$BUFFER"
  zle send-break
}
zle -N hist-no-exec

Unfortunately this doesn't prevent $PREBUFFER from being saved as its own entry.

> > That said ... attached is an actual ZLE implementation of correctall.
>
> I would be much more interested in a "correctnone"

I gathered that before, which is why the correct-all-words widget adds
the '!' response.

The other typical way to get this is to use the "nocorrect" precommand modifier.


  reply	other threads:[~2023-12-18 18:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05  2:12 Vincent Lefevre
2023-12-05  4:10 ` Bart Schaefer
2023-12-05 12:57   ` Vincent Lefevre
2023-12-05 21:22     ` Bart Schaefer
2023-12-06 15:03       ` Vincent Lefevre
2023-12-09 21:44         ` Bart Schaefer
2023-12-17 13:54           ` Vincent Lefevre
2023-12-17 19:37             ` Bart Schaefer
2023-12-18  3:37               ` Vincent Lefevre
2023-12-18  6:36                 ` Bart Schaefer [this message]
2024-01-21  5:06     ` 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:
  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='CAH+w=7aW6YDj7aqkyXXTzTFoKorJT9QCJ5uyEeyXtd7ssYpstg@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@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).