Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Problem with "read -q" / "read -k" and "zle -I"



The "read -q" and "read -k N" builtins are supposed to work inside ZLE
widgets, but when "zle -I" has been executed the read waits for a newline.

# This works fine
zle-line-finish() {
  read -q $'?\nAre you sure [n/y]? '
}
zle -N zle-line-finish

# This waits for a newline
zle-line-finish() {
  zle -I
  read -q $'?\nAre you sure [n/y]? '
}
zle -N zle-line-finish

Note also that a newline is printed before the prompt with "zle -I".

It's necessary to call "zle -I" *after* the read in order to get the
display to update cleanly

See zsh-users "zsh detects rm *" thread for shenanigans that this made
necessary.



Messages sorted by: Reverse Date, Date, Thread, Author