Skip to content

Commit

Permalink
incorporate word wrap into customization menu
Browse files Browse the repository at this point in the history
  • Loading branch information
mtekman committed Nov 1, 2022
1 parent f355b61 commit 809a0f6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions dietpi/func/dietpi-banner
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@
'VPN status'
'Large hostname'
'Print credits'
'Word wrap for small terminals?'

)

# Set defaults: Disable CPU temp by default in VMs
if (( $G_HW_MODEL == 20 ))
then
aENABLED=(1 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1)
aENABLED=(1 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1)
else
aENABLED=(1 0 1 0 0 1 0 0 0 0 0 1 1 0 0 1)
aENABLED=(1 0 1 0 0 1 0 0 0 0 0 1 1 0 0 1 1)
fi

COLOUR_RESET='\e[0m'
Expand Down Expand Up @@ -106,6 +107,7 @@
local title="$1" ## Bold part before ":"
local descp="$2" ## Normal part after ":"

if [ -v WORD_WRAP ]; then
## Strip invisible colour codes in order to accurately measure the visual length
## of a sentence.
local stripped_title="${title//$COLOUR_STRIP/}"
Expand All @@ -132,6 +134,7 @@
descp=$(echo ""$stripped_descp"" | fold -s -w $avail_len)
descp="${descp//$'\n'/$'\n'${left_pad}}"
fi
fi

echo -e "$title $descp"
}
Expand Down Expand Up @@ -291,6 +294,8 @@
G_TERM_CLEAR
Print_Header

# Word Wrap
(( ${aENABLED[16]} == 1 )) && WORD_WRAP=1
# Large Format Hostname
# shellcheck disable=SC1091
(( ${aENABLED[14]} == 1 )) && . /boot/dietpi/func/dietpi-print_large "$(</etc/hostname)" && echo
Expand Down

0 comments on commit 809a0f6

Please sign in to comment.