Skip to content

Commit 449ae3a

Browse files
committed
Flexible submenu padding and corner symbols
1 parent a26fe37 commit 449ae3a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

shellmenu.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,26 @@ clrPurple=5
1414
clrCyan=6
1515
clrWhite=7
1616

17-
# Globals
17+
# Globals (SUBJECT TO CUSTOMIZATION)
1818
waitstatus=true # whether to wait for key press after menu command finished
1919
continuemenu=true # whether to continue menu loop (quit will set this to false)
2020
globalClmWidth=20 # the default (minimum) column width
21-
calculatedMenuWidth=43 # the calculated column width (internal)
2221
actualmenu="EasyKey.shellmenu" # the default menu heading
2322
actualsubmenuname="Your commands:" # the default sub menu heading
2423
menuHeadingFGClr="$clrWhite" # the default menu heading foreground color
2524
menuHeadingBGClr="$clrBlue" # the default menu heading background color
2625
submenuFGClr="$clrCyan" # the default sub menu heading foreground color
2726
submenuBGClr="$clrBlack" # the default sub menu heading background color
2827
delimiter=⊕ # the delimiter used in menu array
28+
submenu_pad_symbol="" # Default submenu border symbol
29+
submenu_corner_symbol="" # Default submenu corner symbol
30+
31+
# Internal global variables (DO NOT CHANGE)
2932
formattedheading="" # the cache for formatted heading
3033
generatedmenu="" # the menu cache (menu will be compiled once and then cached)
3134
menudatamap=() # the menu data
32-
has_two_clms=false # whether the menu hast two columns (internal)
35+
has_two_clms=false # whether the menu hast two columns
36+
calculatedMenuWidth=$(( 2 * globalClmWidth + 3 )) # the calculated column width
3337

3438
############################
3539
############################
@@ -564,8 +568,8 @@ printMenuHeading(){
564568
#################################################
565569
printSubmenuHeading(){
566570
local width="${2:-$calculatedMenuWidth}"
567-
local symbol="${3:-""}"
568-
local paddedline="$(r_pad "$1" "$width" "$symbol")"
571+
local symbol="${3:-$submenu_pad_symbol}"
572+
local paddedline="$(r_pad "$1" "$width" "$symbol")$submenu_corner_symbol"
569573
coloredLog "$paddedline\n\r" "$submenuFGClr" "$submenuBGClr"
570574
}
571575

0 commit comments

Comments
 (0)