From 358fd945f226ac8ca7a21e83ec22239dd2efdb31 Mon Sep 17 00:00:00 2001 From: Sofia <253282481+sofia-riese@users.noreply.github.com> Date: Fri, 23 Jan 2026 13:47:29 +0800 Subject: [PATCH 1/2] fix(tui_layout.sh): apply font color --- scripts/menus/tui_layout.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/menus/tui_layout.sh b/scripts/menus/tui_layout.sh index 8a44f335..42ca4247 100644 --- a/scripts/menus/tui_layout.sh +++ b/scripts/menus/tui_layout.sh @@ -29,15 +29,14 @@ content_line() { currentLine = "" wordBuffer = "" lastColor = "" + savedColor = "" ESC = sprintf("%c", 27) } { n = split($0, chars, "") - for (i = 1; i <= n; i++) { r = chars[i] - if (r == ESC && i+1 <= n && chars[i+1] == "[") { ansiSeq = "" for (j = i; j <= n; j++) { @@ -74,26 +73,28 @@ content_line() { if (r == " " || charWidth == 2) { if (currentDisplayWidth + wordWidth + charWidth > textWidth) { printf " %s\033[0m\033[%dG||\n", currentLine, table_width - currentLine = lastColor wordBuffer + currentLine = savedColor wordBuffer currentDisplayWidth = wordWidth wordBuffer = r wordWidth = charWidth + savedColor = lastColor } else { currentLine = currentLine wordBuffer r currentDisplayWidth += wordWidth + charWidth wordBuffer = "" wordWidth = 0 + savedColor = lastColor } } else { wordBuffer = wordBuffer r wordWidth += charWidth - if (wordWidth > textWidth) { printf " %s%s\033[0m\033[%dG||\n", currentLine, wordBuffer, table_width - currentLine = lastColor + currentLine = savedColor currentDisplayWidth = 0 wordBuffer = "" wordWidth = 0 + savedColor = lastColor } } } @@ -103,7 +104,7 @@ content_line() { if (wordWidth > 0) { if (currentDisplayWidth + wordWidth > textWidth) { printf " %s\033[0m\033[%dG||\n", currentLine, table_width - currentLine = lastColor wordBuffer + currentLine = savedColor wordBuffer } else { currentLine = currentLine wordBuffer } From fed0bfeb90212997d2900e120509095d082b1b1f Mon Sep 17 00:00:00 2001 From: Sofia <253282481+sofia-riese@users.noreply.github.com> Date: Fri, 23 Jan 2026 14:34:35 +0800 Subject: [PATCH 2/2] feat(tui_layout.sh): identify line break "\n" --- scripts/menus/tui_layout.sh | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) 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 {} ' }