-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix TextBox sync issues #14960
Fix TextBox sync issues #14960
Conversation
…text input is handled
You can test this PR using the following package version. |
//Make sure updated text is in sync | ||
_presenter?.SetCurrentValue(TextPresenter.TextProperty, text); | ||
|
||
caretIndex += input.Length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input.Length
is added twice, here and on SetCurrentValue(CaretIndexProperty..., )
below, moving the effective caret twice (the visual one is correct).
Shouldn't we add some small unit test ensuring that TextBox.CaretIndex == _presenter.CaretIndex
in the bugged cases after input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. These unit tests tend to be hard to write because of the property sync. I am having a look. All these issues are caused by the fact that some state is synced via bindings.
…a into fixes/textBoxCaretSync
You can test this PR using the following package version. |
* Sync change text and changed caret index with the TextPresenter when text input is handled * Do not add length again
* Sync change text and changed caret index with the TextPresenter when text input is handled * Do not add length again
What does the pull request do?
What is the current behavior?
What is the updated/expected behavior with this PR?
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes #13648
Fixes #13886
Fixes #14563