PrettyTables.jl icon indicating copy to clipboard operation
PrettyTables.jl copied to clipboard

`AnsiTextCell` and alignment

Open thchr opened this issue 4 years ago • 3 comments

I was expecting that AnsiTextCell would behave somewhat like a "minipage" in LaTeX: i.e. effectively as a rectangular box that is plugged in as an element of the table and isn't affected by alignment in the table itself. Currently, however, the content of AnsiTextCell follows the alignment of the table itself, i.e.: image

I had hoped that every alignment would've not affected the display of each AnsiTextCell. With the current behavior, for wanting AnsiTextCell to print "as-is" relative to its text-representation, one must use alignment = :l or manually ensure that each line in the AnsiTextCell is equally long.

thchr avatar Oct 05 '21 19:10 thchr

Hi @thchr

I see. Actually AnsiTextCell is a customized cell. Each line is treated as a line in a cell. That's why you are seeing this type of behavior.

I really do not want to change this behavior just for AnsiTextCell since every customized cell is handled generically inside PrettyTables.jl. However, we can add an option when creating AnsiTextCell to force every line to have the same length by appending spaces. Will it be enough?

ronisbr avatar Oct 05 '21 19:10 ronisbr

Ah, I see; that's my misunderstanding then.

If there were an option to append spaces automatically to "fill out" short lines, that would indeed be enough and would suit my purposes perfectly!

thchr avatar Oct 05 '21 19:10 thchr

Nice! I will do it!

ronisbr avatar Oct 05 '21 19:10 ronisbr