Use stty instead of read \-s

This commit is contained in:
Dylan 2016-03-29 11:06:29 +11:00
parent 9a7a21d18a
commit 12d7162a2e

View file

@ -1897,6 +1897,7 @@ getimage () {
esac esac
# Get terminal width and height # Get terminal width and height
stty -echo
if [ -n "$TMUX" ]; then if [ -n "$TMUX" ]; then
printf "%b%s" "\033Ptmux;\033\033[14t\033\033[c\033\\" printf "%b%s" "\033Ptmux;\033\033[14t\033\033[c\033\\"
else else
@ -1905,7 +1906,7 @@ getimage () {
# The ascape code above prints the output AFTER the prompt so this # The ascape code above prints the output AFTER the prompt so this
# loop below reads it as input. wtf xterm # loop below reads it as input. wtf xterm
read -d c -s -r term_size read -d c -s -r term_size; stty echo
# Split the string # Split the string
term_size=${term_size//'['} term_size=${term_size//'['}
@ -2843,7 +2844,7 @@ printinfo
if [ "$image" != "off" ]; then if [ "$image" != "off" ]; then
# Get cursor position # Get cursor position
info_height="$(IFS=';' read -srdR -t 1 -d c -p $'\033[6n\033[c' ROW COL; printf "%s" "${ROW#*[}")" info_height="$(stty -echo; IFS=';' read -rdR -t 1 -d c -p $'\033[6n\033[c' ROW COL; printf "%s" "${ROW#*[}")"
# If get cursor pos fails set the value to 0 # If get cursor pos fails set the value to 0
[ -z "$info_height" ] && info_height=0 [ -z "$info_height" ] && info_height=0