diff --git a/scripts/menus/tui_layout.sh b/scripts/menus/tui_layout.sh index 42ca4247..5f3bcea3 100644 --- a/scripts/menus/tui_layout.sh +++ b/scripts/menus/tui_layout.sh @@ -52,10 +52,7 @@ content_line() { } charWidth = 1 - - if (r <= "\177") { - charWidth = 1 - } + if (r <= "\177") { charWidth = 1 } else if (r >= "\340" && r <= "\357" && i+2 <= n) { r = chars[i] chars[i+1] chars[i+2] i += 2 @@ -66,9 +63,6 @@ content_line() { i += 1 charWidth = 1 } - else { - charWidth = 1 - } if (r == " " || charWidth == 2) { if (currentDisplayWidth + wordWidth + charWidth > textWidth) { @@ -98,9 +92,7 @@ content_line() { } } } - } - END { if (wordWidth > 0) { if (currentDisplayWidth + wordWidth > textWidth) { printf " %s\033[0m\033[%dG||\n", currentLine, table_width @@ -110,14 +102,15 @@ content_line() { } } - cleanText = currentLine - gsub(/\033\[[0-9;]*m/, "", cleanText) - gsub(/^[ \t]+|[ \t]+$/, "", cleanText) + printf " %s\033[0m\033[%dG||\n", currentLine, table_width - if (cleanText != "") { - printf " %s\033[0m\033[%dG||\n", currentLine, table_width - } + currentLine = lastColor + currentDisplayWidth = 0 + wordBuffer = "" + wordWidth = 0 + savedColor = lastColor } + END {} ' }