cols: Fix issues

This commit is contained in:
Dylan Araps 2019-12-29 23:46:29 +00:00
parent 5c7ad91bdf
commit 03152764aa
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 7 additions and 6 deletions

View File

@ -1975,8 +1975,8 @@ get_cpu() {
# Select the right temperature file. # Select the right temperature file.
for temp_dir in /sys/class/hwmon/*; do for temp_dir in /sys/class/hwmon/*; do
[[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power|k10temp) ]] && \ [[ "$(< "$temp_dir/name")" =~ (coretemp|fam15h_power|k10temp) ]] &&
{ temp_dir="${temp_dir}/temp1_input"; break; } { temp_dir=$temp_dir/temp1_input; break; }
done done
# Get CPU speed. # Get CPU speed.
@ -3598,12 +3598,13 @@ get_cols() {
printf -v block_spaces "%${block_height}s" printf -v block_spaces "%${block_height}s"
# Convert the spaces into rows of blocks. # Convert the spaces into rows of blocks.
[[ "$blocks" ]] && cols+="${block_spaces// /${blocks}${reset}nl}" [[ "$blocks" ]] && cols+="${block_spaces// /${blocks}nl}"
[[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}${reset}nl}" [[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}nl}"
# Add newlines to the string. # Add newlines to the string.
cols="${cols%%'nl'}" cols=${cols%%nl}
cols="${cols//nl/\\n\\e[${text_padding}C${zws}}" cols=${cols//nl/
[${text_padding}C${zws}}
# Add block height to info height. # Add block height to info height.
((info_height+=block_range[1]>7?block_height+3:block_height+2)) ((info_height+=block_range[1]>7?block_height+3:block_height+2))