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!
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user