muesli4 / table-layout

Layout data in grids and pretty tables. Provides a lot of tools to get the cell formatting right (positional alignment, alignment on specific characters and limiting of cell width)..
BSD 3-Clause "New" or "Revised" License
38 stars 11 forks source link

Generalise Formatted. #19

Closed Xitian9 closed 3 years ago

Xitian9 commented 3 years ago

This type provides an instance of cell that allows adding backend-specific formatting, including different formatting applied to different parts of the content.

Fixes #11.

I think the naming and structure is not ideal, but I wanted to submit this to give you a chance for feedback. Ideally we would replace Formatted with this structure, as it is just a special case, but you may want a different migration/backwards compatibility scheme.

Xitian9 commented 3 years ago

Are there any further changes needed to merge this?

muesli4 commented 3 years ago

Are there any further changes needed to merge this?

Sorry, I will have a look at this merge request and the others this weekend. One thing I was concerned about was that the signature of formatted changed. But since we're breaking compatibility anyway it probably does not matter.

Xitian9 commented 3 years ago

Yes, that's true. I originally had this as multiformatted, but replaced the old formatted because it seemed redundant.

Something to note: even though the signature changes many common use cases will still work, due to the IsString instance of Formatted.

muesli4 commented 3 years ago

Something to note: even though the signature changes many common use cases will still work, due to the IsString instance of Formatted.

Yes, that was exactly my train of thought. :)