Skip to content
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

[TextTrimming] Fixed some text trimming bugs #17998

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dme-compunet
Copy link
Contributor

@dme-compunet dme-compunet commented Jan 18, 2025

What does the pull request do?

There are currently some bugs with text trimming.
@Gillibald sorry I'm sending this while you have an open PR on this issues.

What is the current behavior?

before

What is the updated/expected behavior with this PR?

after

How was the solution implemented (if it's not obvious)?

Currently, text trimming collapses the text-runs in their visual order (and in reverse RTL), after this PR, it collapses the text-runs in their logical order (before bidi-reordering).

Checklist

Fixed issues

Fixes #14068
Fixes #17569
Fixes #17888

@dme-compunet
Copy link
Contributor Author

@adirh3 can you check this branch and make sure it fixes the issues?

@dme-compunet
Copy link
Contributor Author

For comparison, this is what PR #17899 does:

pr17899

@rabbitism
Copy link
Contributor

rabbitism commented Jan 19, 2025

At least the chinese trimming doesn't make sense for me after change.

@Gillibald
Copy link
Contributor

Gillibald commented Jan 19, 2025

Thanks for this. I will have a closer look shortly. I am not so sure we should trim text in logical order.

@Gillibald
Copy link
Contributor

I think you are right that we should trim text in logical order because otherwise text isn't split continuously.

We can't break public API in a minor release so we need to revert the breaking change. Mark the line with a TODO12 comment and add a comment to the breaking change tracking issue.

In general we need unit tests for this PR. My PR wasn't merged because I had no time working on tests yet. I am fine with dropping my PR in favor of my PR.

We need a test that ensures text is trimmed continuously.

We need a test that ensures the ellipsis is drawn at the right position.

We need tests that make sure bidi order isn't altered for trimmed text.

@dme-compunet dme-compunet force-pushed the fixes/bidi-text-trimming branch from 993bd67 to 3bc4b41 Compare January 19, 2025 16:40
@dme-compunet
Copy link
Contributor Author

I have now reverted the breaking changes. one advantage I see in passing the textRun parameter instead of textLine is allowing to a custom text-trimming implementation to get the logical text runs in an easy way.

It's not clear to me how this should be implemented so that it will merge into the next major version, so I'll leave it without breaking changes for now.

I will try to add the unit tests soon.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054325-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@dme-compunet dme-compunet marked this pull request as draft January 19, 2025 17:13
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054327-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054361-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@dme-compunet
Copy link
Contributor Author

@Gillibald there are also some bugs that need to be fixed in TextLeadingPrefixCharacterEllipsis, is it better to open this in a separate PR, or attach it with this PR?

@Gillibald
Copy link
Contributor

A separate PR would be ideal

@dme-compunet dme-compunet marked this pull request as ready for review January 21, 2025 14:42
@dme-compunet
Copy link
Contributor Author

@Gillibald Any thoughts about this? maybe it's best to leave it for v12 with the breaking changes?

@Gillibald
Copy link
Contributor

You should at least create a related issue about your findings. Reviewing your PR shortly. Thanks for your contribution.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054508-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants