Fix box border misalignment — normalize literal \033 in _strlen

This commit is contained in:
SamNet-dev
2026-02-17 15:55:50 -06:00
parent a78d8f763c
commit c132621c55

View File

@@ -127,6 +127,8 @@ TERM_WIDTH=$(tput cols 2>/dev/null || echo 60)
_strlen() { _strlen() {
local clean="$1" local clean="$1"
local esc=$'\033' local esc=$'\033'
# Normalize literal \033 (from single-quoted color vars) to real ESC byte
clean="${clean//$'\\033'/$esc}"
# Strip ANSI escape sequences in pure bash (no subprocesses) # Strip ANSI escape sequences in pure bash (no subprocesses)
while [[ "$clean" == *"${esc}["* ]]; do while [[ "$clean" == *"${esc}["* ]]; do
local before="${clean%%${esc}\[*}" local before="${clean%%${esc}\[*}"