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

Misbehavior of "read" or ...?



On Jan 18,  1:19am, Bart Schaefer wrote to zsh-users:
}
} function xterm-ask {
}   local esc
}   unset REPLY reply
}   1=get_${1#get_}
}   xterm-tell $1
}   case $1 in
}   (get_(label|title))
}       read -t 2 -rk 3 esc || return 1
}       read -rsd $'\e'
}       read -rk 1 esc
}       ;;
}   (get_*)
}       read -t 2 -rk 2 esc || return 1
}       IFS=';' read -Arsd t
}       (( $#reply > 2 )) && shift reply
}       ;;
}   esac
}   return 0
} }

The above works flawlessly in 4.2.6, but in 4.3.4-dev-7 I can't seem to
stop it from echoing the terminal's response in a way that the user can
see it.  Even wrapping the whole thing in "stty -echo" doesn't help.

If I run

    xterm-tell get_position; IFS=';' read -Arsd t

from the command line, it works as expected.  It's only when running
it in a shell function that it misbehaves.  I've tried changing from
"-rk" to "-rsk" in each place it's used; doesn't seem to matter.

I've also redirected the output of "case ... esac" to /dev/null with
no better result.  The response IS getting seen by "read":

schaefer<524> xterm-ask get_position
^[[3;1016;546t%
schaefer<525> print $reply
1016 546
schaefer<526> unset reply
schaefer<527> xterm-tell get_position; IFS=';' read -Arsd t
schaefer<528> print $reply
1016 546

If I "set -x" the output appears immediately after the trace prints that
"read" is going to be executed, so *something* that "read" is doing is
causing the output to be echoed, I think:

: xterm-ask:5:case; case get_iconify (get_*)
: xterm-ask:9:case; read -t 2 -rsk 2 esc
^[[1t^[[1t: xterm-ask:10:case; IFS=';' : xterm-ask:10:case; read -Arsd t
: xterm-ask:11:case; ((  1 > 2  ))
: xterm-ask:13; return 0

I've tried removing the -t 2, skipping the "read -rk", etc.  No change.

This is really annoying.



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