Get the terminal size without the need of a loop
This commit is contained in:
5
fetch
5
fetch
@@ -1815,10 +1815,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
|
||||||
while IFS= read -s -r -n 1 -t 0.25 char; do
|
IFS= read -d t -s -r term_size
|
||||||
[ "$char" == "t" ] && break
|
|
||||||
term_size+=$char
|
|
||||||
done
|
|
||||||
|
|
||||||
# If $img isn't a file or the terminal doesn't support xterm escape sequences,
|
# If $img isn't a file or the terminal doesn't support xterm escape sequences,
|
||||||
# fallback to ascii mode.
|
# fallback to ascii mode.
|
||||||
|
|||||||
Reference in New Issue
Block a user