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
Is your feature request related to a problem? Please describe.
lipgloss always truncates from the left when using MaxWidth because it uses muesli/reflow's truncate.Stringunder the hood, which truncates from the left.
Having support for macOS Finder style truncation ("This is a very l...oong string.txt") would be neat.
A consequence of middle string truncation is that you'd want to be able to specify the string in-between e.g. an ellipsis …, so it would seem natural to allow specifying it for left-truncation too:
(It gets gnarlier because no string is the current default for left truncation, but it would make sense to have a default for middle truncation, so then there would be different defaults? Or maybe lipgloss.TruncateCenter would always need Replacement set)
Apologies I'm not super familiar with this library so not sure what the right syntax should look like, but that was a rough sketch.
Is your feature request related to a problem? Please describe.
lipgloss always truncates from the left when using
MaxWidth
because it uses muesli/reflow'struncate.String
under the hood, which truncates from the left.Having support for macOS Finder style truncation ("This is a very l...oong string.txt") would be neat.
Describe the solution you'd like
Something like this might work?
A consequence of middle string truncation is that you'd want to be able to specify the string in-between e.g. an ellipsis
…
, so it would seem natural to allow specifying it for left-truncation too:(It gets gnarlier because no string is the current default for left truncation, but it would make sense to have a default for middle truncation, so then there would be different defaults? Or maybe
lipgloss.TruncateCenter
would always need Replacement set)Apologies I'm not super familiar with this library so not sure what the right syntax should look like, but that was a rough sketch.
Describe alternatives you've considered
Syntax more like https://www.w3.org/wiki/Text-overflow_middle_cropping would be way more flexible but seems like a really complex way to achieve this; I don't imagine writing this to be very nice:
Also I'm unsure how much would be in scope here or in muesli/reflow.
I filed muesli/reflow#59 to ask whether it should support middle truncation.
Additional context
N/A
The text was updated successfully, but these errors were encountered: