fixed boxborder initialization

This commit is contained in:
alanweinstock 2025-02-26 08:35:50 -08:00
parent 17f82308b1
commit 6ddb1539f3

View file

@ -169,7 +169,7 @@ update_terminal_width() {
# Add trap for terminal resize # Add trap for terminal resize
trap 'update_terminal_width' WINCH trap 'update_terminal_width' WINCH
set_borders() { set_borders() {
top_border=$1 top_border=$1
bottom_border=$2 bottom_border=$2
left_border=$3 left_border=$3
@ -270,7 +270,8 @@ box-light(){
esac esac
} }
#set-boxtype update_terminal_width
set-boxtype
repchar() { repchar() {
# More robust parameter checking # More robust parameter checking
@ -296,6 +297,14 @@ repchar() {
printf -v result "%*s" "$count" "" printf -v result "%*s" "$count" ""
echo "${result// /$char}" echo "${result// /$char}"
} }
test_boxtop() {
echo "Debug - BOXWIDTH: $BOXWIDTH" >&2
echo "Debug - top_border: '$top_border'" >&2
echo "Debug - left_top_border: '$left_top_border'" >&2
local rep_result=$(repchar "$top_border" "$((BOXWIDTH-1))")
echo "Debug - repchar result: '$rep_result'" >&2
printf "%s%s%s\n" "${brdr}$left_top_border" "$rep_result" "$right_top_border${dfl}"
}
boxtop() { boxtop() {
printf "%s%s%s\n" "${brdr}$left_top_border" "$(repchar "$top_border" "$((BOXWIDTH-1))")" "$right_top_border${dfl}" printf "%s%s%s\n" "${brdr}$left_top_border" "$(repchar "$top_border" "$((BOXWIDTH-1))")" "$right_top_border${dfl}"
@ -1465,5 +1474,6 @@ check-packages() {
esac esac
} }
set_box_chars
update_terminal_width
set-boxtype set-boxtype