Merge pull request #281 from outis1one/claude/ionos-script-integration-x32ofw
Pixel-align the header labels with their data columns
This commit is contained in:
@@ -440,21 +440,28 @@ while true; do
|
|||||||
# checkbox at all though (it's not a list item, just a text field),
|
# checkbox at all though (it's not a list item, just a text field),
|
||||||
# so that's where the column header lives — genuinely non-selectable
|
# so that's where the column header lives — genuinely non-selectable
|
||||||
# this way, not just harmless-if-selected like a fake row would be.
|
# this way, not just harmless-if-selected like a fake row would be.
|
||||||
# "installed"/"# of installs" won't character-align with the
|
#
|
||||||
# 1-2-char "x"/count data below (spelled-out words can't line up
|
# The header text ("installed" / "# of installs" / "service") is
|
||||||
# under single-character columns and stay readable) — the leading
|
# wider than the underlying data (an "x"-or-blank mark, a 1-2 digit
|
||||||
# spaces here are a best-effort approximation of where those data
|
# count), so it's the DATA fields that were widened to match the
|
||||||
# columns start, not exact.
|
# header labels' widths (9 and 13 chars) rather than the other way
|
||||||
|
# around — a narrow data column can't align under a wide label and
|
||||||
|
# stay readable, but a wide data column can absolutely align under
|
||||||
|
# a matching-width label. Verified pixel/character-exact (not
|
||||||
|
# eyeballed) by actually rendering this dialog into a captured pty
|
||||||
|
# and measuring column offsets with pyte; the leading spaces on the
|
||||||
|
# header line and the field widths below are tuned to that
|
||||||
|
# measurement, not guessed.
|
||||||
svc_items=()
|
svc_items=()
|
||||||
for name in "${SVCS[@]}"; do
|
for name in "${SVCS[@]}"; do
|
||||||
_inst_mark=" "
|
_inst_field="$(printf '%-9s' '')"
|
||||||
_count_str=" "
|
_count_field="$(printf '%-13s' '')"
|
||||||
_count="$(install_count "$name")"
|
_count="$(install_count "$name")"
|
||||||
if [ "$_count" -gt 0 ]; then
|
if [ "$_count" -gt 0 ]; then
|
||||||
_inst_mark="x"
|
_inst_field="installed"
|
||||||
_count_str="$(printf "%-2d" "$_count")"
|
_count_field="$(printf '%-13s' "$_count")"
|
||||||
fi
|
fi
|
||||||
svc_tag="$(printf "%s %s %s" "$_inst_mark" "$_count_str" "$name")"
|
svc_tag="$(printf "%s %s %s" "$_inst_field" "$_count_field" "$name")"
|
||||||
svc_items+=("$svc_tag" "${SERVICE_DESC[$name]}" "OFF")
|
svc_items+=("$svc_tag" "${SERVICE_DESC[$name]}" "OFF")
|
||||||
done
|
done
|
||||||
CHOICE=$(whiptail --title "${CHOSEN_CAT^^}" --checklist \
|
CHOICE=$(whiptail --title "${CHOSEN_CAT^^}" --checklist \
|
||||||
|
|||||||
Reference in New Issue
Block a user