mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-12-24 04:22:32 +00:00
Reduce tput to a single call
This commit is contained in:
11
fetch.sh
11
fetch.sh
@@ -513,9 +513,6 @@ getimage () {
|
||||
# Check if the directory exists
|
||||
[ ! -d "$imgtempdir" ] && (mkdir "$imgtempdir" || exit)
|
||||
|
||||
# Get columns
|
||||
columns=$(tput cols)
|
||||
|
||||
# Image size is half of the terminal
|
||||
imgsize=$((columns * font_width / split_size))
|
||||
|
||||
@@ -859,6 +856,12 @@ printinfo () {
|
||||
# Call Functions and Finish Up {{{
|
||||
|
||||
|
||||
# Get lines and columns
|
||||
termsize=$(printf "lines \n cols" | tput -S)
|
||||
termsize=${termsize/$'\n'/ }
|
||||
lines=${termsize% *}
|
||||
columns=${termsize#* }
|
||||
|
||||
# Get image
|
||||
[ "$images" == "on" ] && getimage
|
||||
|
||||
@@ -881,7 +884,7 @@ printinfo
|
||||
[ $line_wrap == "off" ] && printf '\e[?7h'
|
||||
|
||||
# Move cursor to bottom and redisplay it.
|
||||
printf "\e[$(tput lines)H\e[1A\e[?25h"
|
||||
printf "\e[${lines}H\e[1A\e[?25h"
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
Reference in New Issue
Block a user