Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Problem with "read -q" / "read -k" and "zle -I"
- X-seq: zsh-workers 32481
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Problem with "read -q" / "read -k" and "zle -I"
- Date: Thu, 13 Mar 2014 09:19:50 -0700
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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