diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-01-15 19:56:18 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-01-15 19:56:18 -0400 |
| commit | 95d1cc62ea655a047333e5224d52c17a70c2d0cb (patch) | |
| tree | de2de8672caae537b469a1396938fe92d7d1b3a1 /src/Utility/Table.hs | |
| parent | 56539e79e0b60f4abbb046b2a66eb5ccf18a983d (diff) | |
avoid unncessary padding on last column in table
Diffstat (limited to 'src/Utility/Table.hs')
| -rw-r--r-- | src/Utility/Table.hs | 3 |
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 |
