From c31be087080b3bb2c96b825ffd5cc4e4ef995862 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Sat, 7 Feb 2026 00:59:12 -0600 Subject: [PATCH] scripts: Fixed accidental double-spacing in table renderer Not sure when this was introduced, but it looks like we were unintentionally double spacing columns in our table renderer. The problem is we add spaces for both fields and notes: a b c d the_thing 100 (+10%) 200 (+20%) 300 (+30%) But unconditionally, so if there are no notes (the common case), the fields end up double-spaced: a b c d the_thing 100 200 300 Fixed by checking x[1], and only adding the second space if we have any notes: a b c d the_thing 100 200 300 --- The funny thing is, after using this table renderer for so long, I assumed the double spacing was intentional. And maybe it should be? Double-spacing does help visually separate neighboring columns at the cost of horizontal density. The only problem being that we really _don't_ have much horizontal density to play with. Many of our table scripts already run past the 80-col mark just due to how much data we want to show. If we do want to double space in the future, we should at least double space after notes as well for consistency. The current impl appears to not be able to make up its mind! --- scripts/code.py | 2 +- scripts/cov.py | 2 +- scripts/csv.py | 2 +- scripts/ctx.py | 2 +- scripts/data.py | 2 +- scripts/perf.py | 2 +- scripts/perfbd.py | 2 +- scripts/stack.py | 2 +- scripts/structs.py | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/code.py b/scripts/code.py index 8bdfef7e..4eee5950 100755 --- a/scripts/code.py +++ b/scripts/code.py @@ -894,7 +894,7 @@ def table(Result, results, diff_results=None, *, for line in lines: for i, x in enumerate(line): widths[i] = max(widths[i], ((len(x[0])+1+4-1)//4)*4-1) - if i != len(line)-1: + if x[1] and i != len(line)-1: nwidths[i] = max(nwidths[i], 1+sum(2+len(n) for n in x[1])) if not any(line[0][0] for line in lines): widths[0] = 0 diff --git a/scripts/cov.py b/scripts/cov.py index f3e046b2..7ed59e57 100755 --- a/scripts/cov.py +++ b/scripts/cov.py @@ -763,7 +763,7 @@ def table(Result, results, diff_results=None, *, for line in lines: for i, x in enumerate(line): widths[i] = max(widths[i], ((len(x[0])+1+4-1)//4)*4-1) - if i != len(line)-1: + if x[1] and i != len(line)-1: nwidths[i] = max(nwidths[i], 1+sum(2+len(n) for n in x[1])) if not any(line[0][0] for line in lines): widths[0] = 0 diff --git a/scripts/csv.py b/scripts/csv.py index 578d8524..e9aba0f2 100755 --- a/scripts/csv.py +++ b/scripts/csv.py @@ -2538,7 +2538,7 @@ def table(Result, results, diff_results=None, *, for line in lines: for i, x in enumerate(line): widths[i] = max(widths[i], ((len(x[0])+1+4-1)//4)*4-1) - if i != len(line)-1: + if x[1] and i != len(line)-1: nwidths[i] = max(nwidths[i], 1+sum(2+len(n) for n in x[1])) if not any(line[0][0] for line in lines): widths[0] = 0 diff --git a/scripts/ctx.py b/scripts/ctx.py index 24176883..201b783a 100755 --- a/scripts/ctx.py +++ b/scripts/ctx.py @@ -1153,7 +1153,7 @@ def table(Result, results, diff_results=None, *, for line in lines: for i, x in enumerate(line): widths[i] = max(widths[i], ((len(x[0])+1+4-1)//4)*4-1) - if i != len(line)-1: + if x[1] and i != len(line)-1: nwidths[i] = max(nwidths[i], 1+sum(2+len(n) for n in x[1])) if not any(line[0][0] for line in lines): widths[0] = 0 diff --git a/scripts/data.py b/scripts/data.py index af312985..797256d4 100755 --- a/scripts/data.py +++ b/scripts/data.py @@ -894,7 +894,7 @@ def table(Result, results, diff_results=None, *, for line in lines: for i, x in enumerate(line): widths[i] = max(widths[i], ((len(x[0])+1+4-1)//4)*4-1) - if i != len(line)-1: + if x[1] and i != len(line)-1: nwidths[i] = max(nwidths[i], 1+sum(2+len(n) for n in x[1])) if not any(line[0][0] for line in lines): widths[0] = 0 diff --git a/scripts/perf.py b/scripts/perf.py index b29aa525..faf51afb 100755 --- a/scripts/perf.py +++ b/scripts/perf.py @@ -1252,7 +1252,7 @@ def table(Result, results, diff_results=None, *, for line in lines: for i, x in enumerate(line): widths[i] = max(widths[i], ((len(x[0])+1+4-1)//4)*4-1) - if i != len(line)-1: + if x[1] and i != len(line)-1: nwidths[i] = max(nwidths[i], 1+sum(2+len(n) for n in x[1])) if not any(line[0][0] for line in lines): widths[0] = 0 diff --git a/scripts/perfbd.py b/scripts/perfbd.py index 1da80ca4..d9d03827 100755 --- a/scripts/perfbd.py +++ b/scripts/perfbd.py @@ -1226,7 +1226,7 @@ def table(Result, results, diff_results=None, *, for line in lines: for i, x in enumerate(line): widths[i] = max(widths[i], ((len(x[0])+1+4-1)//4)*4-1) - if i != len(line)-1: + if x[1] and i != len(line)-1: nwidths[i] = max(nwidths[i], 1+sum(2+len(n) for n in x[1])) if not any(line[0][0] for line in lines): widths[0] = 0 diff --git a/scripts/stack.py b/scripts/stack.py index 2ce8f2bb..1d95852d 100755 --- a/scripts/stack.py +++ b/scripts/stack.py @@ -894,7 +894,7 @@ def table(Result, results, diff_results=None, *, for line in lines: for i, x in enumerate(line): widths[i] = max(widths[i], ((len(x[0])+1+4-1)//4)*4-1) - if i != len(line)-1: + if x[1] and i != len(line)-1: nwidths[i] = max(nwidths[i], 1+sum(2+len(n) for n in x[1])) if not any(line[0][0] for line in lines): widths[0] = 0 diff --git a/scripts/structs.py b/scripts/structs.py index 585fc188..ad01fa71 100755 --- a/scripts/structs.py +++ b/scripts/structs.py @@ -1042,7 +1042,7 @@ def table(Result, results, diff_results=None, *, for line in lines: for i, x in enumerate(line): widths[i] = max(widths[i], ((len(x[0])+1+4-1)//4)*4-1) - if i != len(line)-1: + if x[1] and i != len(line)-1: nwidths[i] = max(nwidths[i], 1+sum(2+len(n) for n in x[1])) if not any(line[0][0] for line in lines): widths[0] = 0