-
Notifications
You must be signed in to change notification settings - Fork 6k
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 editing delta is wrong when using delete
key
#36616
Fix editing delta is wrong when using delete
key
#36616
Conversation
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.
LGTM besides some doc updating. Thanks for fixing this!
@@ -497,7 +500,14 @@ class TextEditingDeltaState { | |||
// we calculate the length of the deleted text by comparing the new and old editing state lengths. | |||
// This value is then subtracted from the end position of the delta to capture the deleted range. |
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.
These comments might also need some updating.
@@ -497,7 +500,14 @@ class TextEditingDeltaState { | |||
// we calculate the length of the deleted text by comparing the new and old editing state lengths. | |||
// This value is then subtracted from the end position of the delta to capture the deleted range. | |||
final int deletedLength = newTextEditingDeltaState.oldText.length - newEditingState.text!.length; | |||
newTextEditingDeltaState.deltaStart = newTextEditingDeltaState.deltaEnd - deletedLength; | |||
final bool backwardDeletion = newEditingState.baseOffset != lastEditingState?.baseOffset; |
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.
This seems fine to me, though I wonder if RTL affects this at all.
5ce5b5d
to
5016d99
Compare
5016d99
to
7cd2dd5
Compare
@bleroux @Renzo-Olivares |
Description
Before this PR, hitting the delete key causes
DeltaTextInputClient
to send incorrect delta on Web platform.Related Issue
Fixes flutter/flutter#112920
Fixes flutter/samples#1424
Tests
Updates 1 test.
Adds 2 tests.