Properly align menu items when there are more than 9.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2414 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2006-08-18 21:11:41 +00:00
parent d55137e472
commit 53866cf077
+9 -2
View File
@@ -269,15 +269,21 @@ $TEMP_TEXT
EOF EOF
fi fi
# Count the number of options
I=0
for ITEM in $TEMP_ITEMS; do
I=$(($I + 1))
done
NUM_ITEMS="$I"
I=0 I=0
for ITEM in $TEMP_ITEMS; do for ITEM in $TEMP_ITEMS; do
I=$(($I + 1)) I=$(($I + 1))
eval TEMP_TYPE="\$MENU_${MENU}_ITEM_${ITEM}_TYPE" eval TEMP_TYPE="\$MENU_${MENU}_ITEM_${ITEM}_TYPE"
eval TEMP_TITLE="\$${TEMP_TYPE}_${ITEM}_TITLE" eval TEMP_TITLE="\$${TEMP_TYPE}_${ITEM}_TITLE"
printf " %i. %-36s %s\n" $I "$TEMP_TITLE" \ printf " %${#NUM_ITEMS}i. %-36s %s\n" $I "$TEMP_TITLE" \
"$(menu_print_value $TEMP_TYPE $ITEM)" "$(menu_print_value $TEMP_TYPE $ITEM)"
done done
NUM_ITEMS="$I"
echo echo
echo "Press a number plus <ENTER> if you want to change something, " echo "Press a number plus <ENTER> if you want to change something, "
@@ -347,6 +353,7 @@ EOF
# Also, count the number of options # Also, count the number of options
I=0 I=0
for OPTION in $TEMP_OPTIONS; do for OPTION in $TEMP_OPTIONS; do
I=$(($I + 1))
menu_have_choice "$MENU" "$OPTION" menu_have_choice "$MENU" "$OPTION"
done done
NUM_OPTIONS="$I" NUM_OPTIONS="$I"