c83ca51b1b2fce89c5eae0b0bc9600ee4df28e08

Author
Marc Cornellà <marc@mcornella.com>
Committer
Marc Cornellà <marc@mcornella.com>
Date

Message

fix(history): fix confirmation prompt to allow bypass

See https://github.com/ohmyzsh/ohmyzsh/issues/12472#issuecomment-2171461005

Diff

 1diff --git a/lib/history.zsh b/lib/history.zsh
 2index 1093ea80fb770c6053b35feac5b79edf82f9ec04..fa3db927e71b85efe65931f50e078af79c0b8c31 100644
 3--- a/lib/history.zsh
 4+++ b/lib/history.zsh
 5@@ -9,9 +9,8 @@ function omz_history {
 6 
 7     # confirm action before deleting history
 8     print -nu2 "This action will irreversibly delete your command history. Are you sure? [y/N] "
 9-    builtin read -k1
10-    [[ "$REPLY" = $'\n' ]] || print -u2
11-    [[ "$REPLY" != ([yY]) ]] && return 0
12+    builtin read
13+    [[ "$REPLY" = [yY] ]] || return 0
14 
15     print -nu2 >| "$HISTFILE"
16     fc -p "$HISTFILE"