zsh-workers
 help / color / mirror / code / Atom feed
* Problem with "read -q" / "read -k" and "zle -I"
@ 2014-03-13 16:19 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2014-03-13 16:19 UTC (permalink / raw)
  To: zsh-workers

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-13 16:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-13 16:19 Problem with "read -q" / "read -k" and "zle -I" Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).