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

Port WPF's FormattedText to Avalonia and rework TextPresenter #4893

Merged
merged 19 commits into from
Feb 1, 2022

Conversation

Gillibald
Copy link
Contributor

@Gillibald Gillibald commented Oct 20, 2020

What does the pull request do?

WPF

WPF

Avalonia

Screenshot 2021-01-11 162531

https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.formattedtext?view=netcore-3.1

What is the current behavior?

What is the updated/expected behavior with this PR?

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

ToDos

  • TextAlignment Center, Right
  • Fix SelectAll for empty text
  • GlyphRunTests.Should_Get_Distance_From_CharacterHit RTL
  • HitTestPoint RTL
  • BiDirectional HitTestTextRange
  • BiDirectional selection
  • BiDi algorithm
  • BiDi reorder
  • RTL text editing / caret movement
  • RTL text highlighting / styles

Checklist

Breaking changes

Fixed issues

Fixes: #4755 #4754 #4708 #5111 #5130 #5233 #1817 #3777

Depending on: #6785

@Gillibald Gillibald force-pushed the feature/FormattedTextPort branch from c32dd6d to d173d08 Compare December 19, 2020 18:14
@Gillibald Gillibald changed the title [WIP] Port WPF's FormattedText to Avalonia [WIP] Port WPF's FormattedText to Avalonia and rework TextPresenter Dec 19, 2020
@Gillibald Gillibald force-pushed the feature/FormattedTextPort branch from d428185 to 94b588d Compare January 12, 2021 15:28
@Gillibald Gillibald force-pushed the feature/FormattedTextPort branch 2 times, most recently from 77a407d to 86949bd Compare February 1, 2021 17:03
@adirh3
Copy link
Contributor

adirh3 commented Mar 15, 2021

@Gillibald Hey, just wondering what is the status of this? Is it ready and waiting for 11.0 since it's breaking change?

@Gillibald
Copy link
Contributor Author

Most of the required changes are made. For TextPreseneter some user interaction needs to be optimized and we need proper testing until this can get merged into master. Could be that we abandon the changes made to TextPresenter and instead port WPF's TextBox implementation. This highly depends on how long #5461 takes.

FormattedText related changes will be merged when we can merge breaking changes.

@adirh3
Copy link
Contributor

adirh3 commented Mar 15, 2021

Most of the required changes are made. For TextPreseneter some user interaction needs to be optimized and we need proper testing until this can get merged into master. Could be that we abandon the changes made to TextPresenter and instead port WPF's TextBox implementation. This highly depends on how long #5461 takes.

FormattedText related changes will be merged when we can merge breaking changes.

Thanks for the info. Does it include the RTL and IME support?
Also, you are probably aware of it, but when I tried using this build it crashes on IndexOutOfRange when typing in Hebrew.

Let me know if you need help with testing.

@Gillibald
Copy link
Contributor Author

I have just tested some basic copy-paste of Emoji-Sequences combined with caret navigation and text selection. Haven't tested RTL text.

@Shayan-To
Copy link

I also can help testing RTL (and probably other things).

When will this be done?

@Gillibald
Copy link
Contributor Author

This is currently blocked by other PR's. This will move on after the next release. Probably next week.

@Gillibald Gillibald force-pushed the feature/FormattedTextPort branch from 7225d8b to 1883d8b Compare April 15, 2021 17:10
@Gillibald
Copy link
Contributor Author

I can reproduce the crash. RTL text editing is still not ready. I will let you know when I need your input.

@Gillibald
Copy link
Contributor Author

#6043

@Gillibald Gillibald force-pushed the feature/FormattedTextPort branch 2 times, most recently from 9ba6cdf to 2cc9524 Compare July 23, 2021 15:10
@Gillibald Gillibald force-pushed the feature/FormattedTextPort branch from a9dec62 to 887ee05 Compare July 30, 2021 18:21
@Gillibald Gillibald force-pushed the feature/FormattedTextPort branch from 9656f71 to f9f10f0 Compare August 18, 2021 13:11
@Gillibald Gillibald changed the title [WIP] Port WPF's FormattedText to Avalonia and rework TextPresenter Port WPF's FormattedText to Avalonia and rework TextPresenter Aug 18, 2021
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018374-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

Copy link
Collaborator

@MarchingCube MarchingCube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After my initial testing it seems that main editing workflow is working fine. Let's get this merged and get more feedback.

@danielmayost
Copy link
Contributor

danielmayost commented Jan 31, 2022

There are a few more, if editing text is an ongoing work, it can be addressed after merge.

(from ControlCatalog):

  1. <TextBox Width="200" Text="RightToLeft text" FlowDirection="RightToLeft" /> has bouncy selection:

  1. a אבג 1 not selected:

  1. <TextBox Width="200" Text="אבג" TextAlignment="Left" /> The cursor goes backwards by typing a space:

  1. <TextBox Width="200" FlowDirection="RightToLeft" /> Type א and then a changes the baseline:

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018388-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@Gillibald
Copy link
Contributor Author

BidiSelection

@Gillibald
Copy link
Contributor Author

  1. src/Avalonia.Visuals/Utilities/Span.cs needs to be modernized in a future PR
  2. RTL text editing/caret movement will be worked on in an upcoming PR

@Gillibald Gillibald merged commit 17e334b into AvaloniaUI:master Feb 1, 2022
@Gillibald Gillibald mentioned this pull request Feb 1, 2022
@Mikolaytis
Copy link
Contributor

Mikolaytis commented Feb 4, 2022

@Gillibald congrats! Finally merged! :)

@Gillibald Gillibald deleted the feature/FormattedTextPort branch February 4, 2022 13:20
@Gillibald
Copy link
Contributor Author

Thanks

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

Successfully merging this pull request may close these issues.

Unsupported characters (specifically emojis) break the textbox