From 0317d12e1db7b534b1b014e645a6e1bd7a1e096a Mon Sep 17 00:00:00 2001 From: Sofia <253282481+sofia-riese@users.noreply.github.com> Date: Sat, 17 Jan 2026 12:54:02 +0800 Subject: [PATCH 1/4] feat(tui): add layout utilities for terminal UI formatting Prepare for future TUI modifications --- scripts/tui/layout.sh | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 scripts/tui/layout.sh diff --git a/scripts/tui/layout.sh b/scripts/tui/layout.sh new file mode 100644 index 00000000..aa0d39b4 --- /dev/null +++ b/scripts/tui/layout.sh @@ -0,0 +1,50 @@ +# tui/layout.sh +# Terminal UI layout helpers +# Provides menu/table formatting utilities + + +# set the total width of the menu +# (adjusting this number will automatically change the entire menu, including the separator lines) +# note: The number represents the number of columns that appear when the "||" appears on the right +TABLE_WIDTH=60 + +# define two extra-long template strings in advance +# (the length should be greater than the expected TABLE_WIDTH) +FULL_EQ="====================================================================================================" +FULL_DASH="- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " + +# function to print content lines +# (using cursor jump) +content_line() { + echo -e " ${1}\033[${TABLE_WIDTH}G||" +} + +# function to print sub content lines +# for printing accompanying instructions +sub_content_line() { + echo -e " ${1}\033[${TABLE_WIDTH}G||" + content_line +} + +# increase the spacing between the front +# and back forms to improve readability +double_line_break() { + printf "\n\n" +} + +# function to print separators +# (using string slicing) +# parameter $1: pass in "=" or "-" +separator_line() { + local separator_type="$1" + local output_line="" + local len=$((TABLE_WIDTH - 1)) + + if [ "$separator_type" == "=" ]; then + output_line="${FULL_EQ:0:$len}" + else + output_line="${FULL_DASH:0:$len}" + fi + + echo "${output_line}||" +} From a3a8e9aa8607e16ffdc714ebcb9bc142929e6efa Mon Sep 17 00:00:00 2001 From: Sofia <253282481+sofia-riese@users.noreply.github.com> Date: Sat, 17 Jan 2026 12:55:02 +0800 Subject: [PATCH 2/4] Update menu.sh --- scripts/menu.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/menu.sh b/scripts/menu.sh index 138da872..b0fd1685 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -19,6 +19,7 @@ CFG_PATH="$CRASHDIR"/configs/ShellCrash.cfg . "$CRASHDIR"/libs/i18n.sh . "$CRASHDIR"/menus/1_start.sh . "$CRASHDIR"/menus/running_status.sh +# . "$CRASHDIR"/tui/layout.sh # 加载语言 load_lang common From 28de72256039bb387da18841959ad96d42803fbc Mon Sep 17 00:00:00 2001 From: Sofia <253282481+sofia-riese@users.noreply.github.com> Date: Sat, 17 Jan 2026 13:12:08 +0800 Subject: [PATCH 3/4] update --- scripts/{tui/layout.sh => menus/tui_layout.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{tui/layout.sh => menus/tui_layout.sh} (100%) diff --git a/scripts/tui/layout.sh b/scripts/menus/tui_layout.sh similarity index 100% rename from scripts/tui/layout.sh rename to scripts/menus/tui_layout.sh From 04c5f088ba369f9b2d254d9010993bd153cc6f7c Mon Sep 17 00:00:00 2001 From: Sofia <253282481+sofia-riese@users.noreply.github.com> Date: Sat, 17 Jan 2026 13:13:33 +0800 Subject: [PATCH 4/4] update --- scripts/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/menu.sh b/scripts/menu.sh index b0fd1685..d3db9dce 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -19,7 +19,7 @@ CFG_PATH="$CRASHDIR"/configs/ShellCrash.cfg . "$CRASHDIR"/libs/i18n.sh . "$CRASHDIR"/menus/1_start.sh . "$CRASHDIR"/menus/running_status.sh -# . "$CRASHDIR"/tui/layout.sh +# . "$CRASHDIR"/menus/tui_layout.sh # 加载语言 load_lang common