kellyjonbrazil/jtbl

Improve auto-scaling to fit terminal width

kellyjonbrazil opened this issue · 1 comments

Right now auto-scaling the column width to fit inside the terminal is pretty rudimentary.

I'm adding up all of the longest items, whether the header or the data values, seeing if they are larger than the terminal width and then setting a maximum column width that should allow the table to fit if all columns are the same size.

Since some columns are smaller than the evenly divided column length this doesn't always fully fill the terminal width.

There is also no logic to do something different if the table is clearly too wide to ever fit, no matter how small the columns get. Maybe need to remove columns that would fall off the screen.

Wondering if this problem has already been solved somehow. I'll continue to make incremental improvements, but if someone else knows how to solve this I'm open to ideas.

Think I implemented a decent solution in v0.5.0