read: Use -s flag instead of stty

This commit is contained in:
Dylan Araps 2016-08-26 11:27:58 +10:00
parent db8aebd216
commit d41d805f1a

View file

@ -1904,7 +1904,6 @@ 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\\"
read_flags="-d c" read_flags="-d c"
@ -1918,8 +1917,7 @@ getimage() {
fi fi
# The escape code above prints the output AFTER the prompt so this # The escape code above prints the output AFTER the prompt so this
read -t 1 ${read_flags} -s -r term_size builtin read -s -t 1 ${read_flags} -r term_size
stty echo
# Split the string # Split the string
if [ "$image_backend" == "tycat" ]; then if [ "$image_backend" == "tycat" ]; then
@ -2632,7 +2630,7 @@ kdeconfigdir() {
dynamicprompt() { dynamicprompt() {
# 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="$(IFS=';' builtin read -srdR -t 1 -d c -p $'\033[6n\033[c' ROW COL; printf "%s" "${ROW#*[}")"
# Calculate image height in terminal cells. # Calculate image height in terminal cells.
# The '+ 3' adds a gap between the prompt and the content. # The '+ 3' adds a gap between the prompt and the content.