From 8908e6d7207223d876b9a74f0be0f0ebb01b361f Mon Sep 17 00:00:00 2001 From: Nick Glenn <78454343+Sargates@users.noreply.github.com> Date: Thu, 13 Jun 2024 02:26:17 -0500 Subject: [PATCH] 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 --- lib/history.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"