From 2b35ac9f45df9c909517fa8d3c8223d082833be8 Mon Sep 17 00:00:00 2001 From: eightpigs Date: Sat, 14 Apr 2018 21:07:19 +0800 Subject: [PATCH] Replace tput with $COLUMNS --- plugins/year-progress/year-progress.plugin.zsh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/year-progress/year-progress.plugin.zsh b/plugins/year-progress/year-progress.plugin.zsh index 4d6fe912..cefebde8 100644 --- a/plugins/year-progress/year-progress.plugin.zsh +++ b/plugins/year-progress/year-progress.plugin.zsh @@ -14,15 +14,11 @@ year_progress() { # progress=current/year value=`echo "$current $len" | awk '{printf ("%.2f\n",$1/$2)}'` - # Get the number of columns in the terminal - tput init - cols=`tput cols` - val2=$(($current*100/$len)) info=$val2%' '$current/$len - cols=$(($cols-${#info})) + cols=$(($COLUMNS-${#info})) # Fill the proportion of the screen scale=`echo "$cols" | awk '{printf ("%.2f\n",$1/100)}'`