Split `wrap` parameter of `rio.Text` and `rio.Markdown` into two different parameters
Closed this issue · 5 comments
Description:
The current wrap
parameter of rio.Text
combines two functionalities: wrapping text and ellipsizing text when it reaches the end of the line. This combination is confusing and should be separated into two distinct parameters for clarity.
Current Implementation:
wrap: bool | Literal["ellipsize"] = False
Proposed Implementation:
wrap: bool = False
ellipsize: bool = False
By splitting these functionalities, we can improve code readability and make the behavior of text handling more explicit.
I don't like the idea of making two parameters because that allows the nonsensical combination wrap=True, ellipsize=True
. Wouldn't it be better to just rename the parameter? Something like overflow_behavior
maybe?
I understand your point, but simply renaming the parameter to something like overflow_behavior
wouldn’t fully address the clarity issue. If we were to adjust it to something like:
overflow_behavior: Literal["no_wrap", "wrap", "ellipsize"] = "no_wrap"
it could work, but I believe there's an even better solution to achieve our goal of making it more clear to the user. :D
So, without even looking at this issue, our favored solution would be something like
overflow: Literal['nowrap', 'wrap', 'ellipsize'] = 'nowrap'
Would that be okay with you @Sn3llius ? I know it's very similar to what you just said you don't want it to be
as discussed I'm fine with the solution :)
Implemented