You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 6, 2023. It is now read-only.
I agree this should be an important feature, as well as center-aligning. From a technical perspective it shouldn't be too rough to implement. We have the string and can get the length of it (.length() or .chars().count()), and we also have the column spacing provided during rendering.
@fdehau, are there any plans to add alignment? An obvious use-case is numeric data column for more spreadsheet-like tabular layouts.
I experimented with a DIY approach using pad, but the issue I ran into was calculating a specific column size when using percentage widths. I tried using f.size() and factoring margins/padding manually, but the logic got unwieldy trying to preempt dimensions in userland.
Would be ideal to have this baked into render calculations. Perhaps Text could offer a .align(Alignment::Right), using the existing Alignment struct in a layout?
Is your feature request related to a problem? Please describe.
There are times when I want to right-align text in a table, e.g. numbers.
Describe the solution you'd like
Ability to right-align text
Describe alternatives you've considered
Adding spacing is tricky, as we don't exactly know how wide the column is from within our application.
The text was updated successfully, but these errors were encountered: