mirror of https://github.com/ohmyzsh/ohmyzsh.git
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>pull/12502/head
parent
6c021fd432
commit
8908e6d720
|
@ -11,7 +11,7 @@ function omz_history {
|
||||||
print -nu2 "This action will irreversibly delete your command history. Are you sure? [y/N] "
|
print -nu2 "This action will irreversibly delete your command history. Are you sure? [y/N] "
|
||||||
builtin read -k1
|
builtin read -k1
|
||||||
[[ "$REPLY" = $'\n' ]] || print -u2
|
[[ "$REPLY" = $'\n' ]] || print -u2
|
||||||
[[ "$REPLY" != ([nN]|$'\n') ]] || return 0
|
[[ "$REPLY" != ([yY]) ]] && return 0
|
||||||
|
|
||||||
print -nu2 >| "$HISTFILE"
|
print -nu2 >| "$HISTFILE"
|
||||||
fc -p "$HISTFILE"
|
fc -p "$HISTFILE"
|
||||||
|
|
Loading…
Reference in New Issue