image: Use stty instead of sequence first.

This commit is contained in:
Dylan Araps 2018-06-19 09:21:48 +10:00
parent 2783446387
commit 94362674f2
2 changed files with 14 additions and 21 deletions

View file

@ -3608,15 +3608,7 @@ get_window_size() {
get_term_size() {
# Get the terminal size in cells.
printf '%b' '\e[18t'
IFS=';t' read -d t -t 0.05 -sra term_cells
lines="${term_cells[1]}"
columns="${term_cells[2]}"
# Fallback to stty if above sequence isn't supported.
[[ -z "$lines" || -z "$columns" ]] && \
read -r lines columns < <(stty size)
read -r lines columns < <(stty size)
# Calculate font size.
font_width="$((term_width / columns))"