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
Spec for Enhanced Text Trimming with Prefix Ellipse
Extracted from the PR: #7322. The initial idea isn't my own; however, I wanted to make sure this was more widely seen and reviewed. It would be nice to get in the habit of publicly debating features such as this as is usually done in the WinUI repository.
Overview
Fundamentally, there are a few different generalized concepts:
BreakMode : By 'Word' or 'Character'
EllipsisLocation : Start (new), End
Note that Middle is not required as the PrefixLength/SuffixLength imply this instead
PrefixLength/SuffixLength or Length (new)
PrefixLength/SuffixLength can be the same property as the start/end information is provided separately (not sure a good name though)
Specifying a length will position the ellipsis in the middle of the text
This all could and probably should be calculated using a single generalized method which would support:
Break
Location
Example
Word
End
"first second ..."
Length=0
Word
Start
"... second third"
Length=0
Word
Start
"first... third"
Length=1
Character
End
"first second th..."
Length=0
Character
End
"first seco...hird"
Length=4
Character
Start
"...st second third"
Length=0
Character
Start
"firs...cond third"
Length=4
Character break mode supports a configurable PrefixLength as specified above but should be extended to support a SuffixLength as well. This would allow ellipsis in the middle that are fully configurable.
Prefix/SuffixLength can also apply to Word break mode. Fallback logic is as follows:
If the length is too long to display, reduce the length to the next integer that fits
If even length=1 cannot fit the entire word, switch to using standard character break mode with no length
Using Prefix/SuffixLength with Word break mode is a bit more complicated to implement and isn't needed in the initial implementation. However, it should be included in the spec so it can be added later.
TextTrimming Enum
Usage in code would involve the following fields:
None (default)
Clip [Optional] from UWP and CSS spec that trims text by clipping at the pixel level instead of removing characters or words
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Spec for Enhanced Text Trimming with Prefix Ellipse
Extracted from the PR: #7322. The initial idea isn't my own; however, I wanted to make sure this was more widely seen and reviewed. It would be nice to get in the habit of publicly debating features such as this as is usually done in the WinUI repository.
Overview
Fundamentally, there are a few different generalized concepts:
This all could and probably should be calculated using a single generalized method which would support:
TextTrimming Enum
Usage in code would involve the following fields:
None
(default)Clip
[Optional] from UWP and CSS spec that trims text by clipping at the pixel level instead of removing characters or wordsCharacterEllipsis
represents BreakMode=Character, EllipsisLocation=End, Length=0WordEllipsis
represents BreakMode=Word, EllipsisLocation=End, Length=0PrefixCharacterEllipsis
represents BreakMode=Character, EllipsisLocation=Start, Length=0PrefixWordEllipsis
represents BreakMode=Word, EllipsisLocation=Start, Length=0Open Questions:
References & Links
Beta Was this translation helpful? Give feedback.
All reactions