wbailey / command_line_reporter

A gem for making it easy to produce a report while a ruby script is executing
Apache License 2.0
432 stars 23 forks source link

Don't inherit column width for last column of a row #34

Open onlynone opened 5 years ago

onlynone commented 5 years ago

The code here currently sets width (along with some other attributes) on every column to the width of the corresponding column of the first row of the table.

That works well for all columns except the last when the lines are close to wrapping in a terminal window. With the current setup, if the first row is wider than the user's terminal, it will wrap, and because of the above behavior, so will all the other lines because they'll be right-padded with spaces to match the width of the first row.

I'd propose changing the code to only inherit width for the last column of a row if the text in that column is longer than the first rows's width. Either that, or just don't right-pad the last column of each row on output regardless of the column's width.