summaryrefslogtreecommitdiff
path: root/src/Utility
diff options
context:
space:
mode:
authorJoey Hess2015-01-15 19:56:18 -0400
committerJoey Hess2015-01-15 19:56:18 -0400
commit95d1cc62ea655a047333e5224d52c17a70c2d0cb (patch)
treede2de8672caae537b469a1396938fe92d7d1b3a1 /src/Utility
parent56539e79e0b60f4abbb046b2a66eb5ccf18a983d (diff)
avoid unncessary padding on last column in table
Diffstat (limited to 'src/Utility')
-rw-r--r--src/Utility/Table.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Utility/Table.hs b/src/Utility/Table.hs
index 4e862ff6..3d1a3980 100644
--- a/src/Utility/Table.hs
+++ b/src/Utility/Table.hs
@@ -22,7 +22,8 @@ formatTable table = map (\r -> unwords (map pad (zip r rowsizes))) table
where
pad (cell, size) = cell ++ take (size - length cell) padding
padding = repeat ' '
- rowsizes = sumrows (map (map length) table)
+ rowsizes = reverse $ (0:) $ drop 1 $ reverse $
+ sumrows (map (map length) table)
sumrows [] = repeat 0
sumrows [r] = r
sumrows (r1:r2:rs) = sumrows $ map (uncurry max) (zip r1 r2) : rs