From 00e6c6e0f5bd48d730d77e76379cfd0b17325a70 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Mon, 18 Feb 2008 03:30:22 +0000 Subject: unposted: Functions/Misc/xtermctl: update uses of "read" to take advantage of users/12600. --- ChangeLog | 3 +++ Functions/Misc/xtermctl | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e69bf5ccd..9d7134884 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ so that terminal input modes are set before attempting a read-poll. Also display any prompt before read-polling. + * unposted: Functions/Misc/xtermctl: update uses of "read" to + take advantage of users/12600. + 2008-02-17 Peter Stephenson * 24566: Doc/Zsh/prompt.yo, Src/prompt.c: fallout: diff --git a/Functions/Misc/xtermctl b/Functions/Misc/xtermctl index 04fcf3637..c771fc39a 100644 --- a/Functions/Misc/xtermctl +++ b/Functions/Misc/xtermctl @@ -44,19 +44,23 @@ function xterm-tell { print -nr -- $'\e['"${seq}"t } +# The following use of "read -st 2 ..." with the control sequences in +# the prompt string requires zsh 4.3.5-dev-1 or later (zsh-users/12600 +# or equivalent patch). + function xterm-ask { local esc unset REPLY reply 1=get_${1#get_} - xterm-tell $1 + local seq=${xtermseq[$1]:?no such control} case $1 in (get_(label|title)) - read -t 2 -rk 3 esc || return 1 - read -rsd $'\e' - read -rk 1 esc + read -st 2 -rk 3 esc$'?\e['"${seq}"t || return 1 + read -srd $'\e' + read -srk 1 esc ;; (get_*) - read -t 2 -rk 2 esc || return 1 + read -st 2 -rk 2 esc$'?\e['"${seq}"t || return 1 IFS=';' read -Arsd t (( $#reply > 2 )) && shift reply ;; -- cgit 1.4.1