diff options
| author | Nick Glenn <78454343+Sargates@users.noreply.github.com> | 2024-06-13 02:26:17 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-13 09:26:17 +0200 |
| commit | 8908e6d7207223d876b9a74f0be0f0ebb01b361f (patch) | |
| tree | f657ffe68cc22690569c0ae4d410447a991ac76a /lib/history.zsh | |
| parent | 6c021fd432aae13ef594342f9b3739ccaca4fcdc (diff) | |
| download | zsh-8908e6d7207223d876b9a74f0be0f0ebb01b361f.tar.gz zsh-8908e6d7207223d876b9a74f0be0f0ebb01b361f.tar.bz2 zsh-8908e6d7207223d876b9a74f0be0f0ebb01b361f.zip | |
fix(history): fix logic error in prompt for `history -c` (#12500)
Logic error in `history -c` when prompting for confirmation caused history
to be deleted when typing anything but explicitly `n`, `N`, or sending `\n`.
New logic prevents deletion by pressing wrong key and only deletes
history when sending `y` or `Y`.
Co-authored-by: Sargates <nicholas.g.glenn@gmail.com>
Diffstat (limited to 'lib/history.zsh')
| -rw-r--r-- | lib/history.zsh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/history.zsh b/lib/history.zsh index b13e1807f..1093ea80f 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -11,7 +11,7 @@ function omz_history { print -nu2 "This action will irreversibly delete your command history. Are you sure? [y/N] " builtin read -k1 [[ "$REPLY" = $'\n' ]] || print -u2 - [[ "$REPLY" != ([nN]|$'\n') ]] || return 0 + [[ "$REPLY" != ([yY]) ]] && return 0 print -nu2 >| "$HISTFILE" fc -p "$HISTFILE" |
