1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 04:30:24 +02:00

unposted: Functions/Misc/xtermctl: update uses of "read" to take advantage

of users/12600.
This commit is contained in:
Bart Schaefer 2008-02-18 03:30:22 +00:00
parent f278876538
commit 00e6c6e0f5
2 changed files with 12 additions and 5 deletions

View file

@ -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
;;