-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fixes for TextLeadingPrefixCharacterEllipsis #19387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fixes for TextLeadingPrefixCharacterEllipsis #19387
Conversation
…e TextRun per line.
You can test this PR using the following package version. |
|
@cla-avalonia agree |
We should probably inherit the bidi level from the split run, so nothing changes. Could you clarify when TextFormatterImpl.SplitTextRuns produces wrong results? |
You can test this PR using the following package version. |
I think the text trimming implementation needs to be rewritten so it uses the hit testing APIs to find the actual split positions. We need to find the run that is at the split position and remove glyphs from it until the line fits into the requested width. This is a single position for trailing or leading ellipses and two positions for trimming with a defined prefix/suffix. In the end, the algorithm should not change the bidi order, etc. |
What does the pull request do?
TextLeadingPrefixCharacterEllipsis
can now correctly handle multiple TextRuns.This is a followup for #17998
And fix for #19339
What is the current behavior?
Current implementation of
TextLeadingPrefixCharacterEllipsis
only works whenTextLine
has a singleShapedTextRun
.When there's more (there are emojis or special characters) it breaks by crashing (in debug mode) or incorrectly accumulates
availableWidth
which ends up excessively trimming the text (in some cases only leaving the ellipsis).This affects
TextTrimming="LeadingCharacterEllipsis"
andTextTrimming="PrefixCharacterEllipsis"
:What is the updated/expected behavior with this PR?
TextLeadingPrefixCharacterEllipsis
should now correctly measure the text and prepare the prefix:How was the solution implemented (if it's not obvious)?
Update
TextLeadingPrefixCharacterEllipsis.Collapse
logic.Checklist
Known issue:
PrefixCharacterEllipsis
has inconsistent results with RTL text (ie. hebrew characters)TextFormatterImpl.SplitTextRuns
return value might not be correct…
) is lower than rest of text which can cause unexpected reordering of prefixFixed issues
Fixes #19339