From 3afd7226f2244547196613e63aa025603ab88bac Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 10 Aug 2026 16:40:18 +0000 Subject: [PATCH] Pixel-align the header labels with their data columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous commit's leading-space count for the header was an estimate and visibly off in the follow-up screenshot. Rather than guess again, actually rendered the dialog into a captured pty (whiptail installed locally, output fed through pyte to reconstruct the real character grid) and measured exact column offsets instead of eyeballing. Root fix: "installed" (9 chars) and "# of installs" (13 chars) are wider than the underlying data (an "x"-or-blank mark, a 1-2 digit count) — a narrow data column can never align under a wide label and stay readable, so it's the data fields that got widened to match the label widths, not the other way around. Verified alignment holds across installed/ not-installed/double-digit-count rows and at the narrow 78-column width floor (where the description truncates first now, not the install status — correct priority, since status is the more critical of the two). --- setup.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/setup.sh b/setup.sh index 339d9a5..f751d61 100755 --- a/setup.sh +++ b/setup.sh @@ -440,25 +440,32 @@ while true; do # 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 # 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 - # under single-character columns and stay readable) — the leading - # spaces here are a best-effort approximation of where those data - # columns start, not exact. + # + # The header text ("installed" / "# of installs" / "service") is + # wider than the underlying data (an "x"-or-blank mark, a 1-2 digit + # count), so it's the DATA fields that were widened to match the + # 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=() for name in "${SVCS[@]}"; do - _inst_mark=" " - _count_str=" " + _inst_field="$(printf '%-9s' '')" + _count_field="$(printf '%-13s' '')" _count="$(install_count "$name")" if [ "$_count" -gt 0 ]; then - _inst_mark="x" - _count_str="$(printf "%-2d" "$_count")" + _inst_field="installed" + _count_field="$(printf '%-13s' "$_count")" 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") done CHOICE=$(whiptail --title "${CHOSEN_CAT^^}" --checklist \ - " installed # of installs service + " installed # of installs service Space=select to install, Enter=go:" "$_box_h" "$_box_w" "$_list_h" \ "${svc_items[@]}" 3>&1 1>&2 2>&3