This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix editing delta is wrong when using delete key
#36616
Merged
auto-submit
merged 2 commits into
flutter:main
from
NevercodeHQ:fix_editing_delta_is_wrong_for_deletion
Oct 6, 2022
Merged
Fix editing delta is wrong when using delete key
#36616
auto-submit
merged 2 commits into
flutter:main
from
NevercodeHQ:fix_editing_delta_is_wrong_for_deletion
Oct 6, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Renzo-Olivares
approved these changes
Oct 5, 2022
Contributor
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!
| if (isTextBeingRemoved) { | ||
| // When text is deleted outside of the composing region or is cut using the native toolbar, | ||
| // 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. |
Contributor
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.
| // 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; |
Contributor
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 |
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Oct 6, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Oct 6, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
autosubmit
Merge PR when tree becomes green via auto submit App
platform-web
Code specifically for the web engine
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Before this PR, hitting the delete key causes
DeltaTextInputClientto send incorrect delta on Web platform.Related Issue
Fixes flutter/flutter#112920
Fixes flutter/samples#1424
Tests
Updates 1 test.
Adds 2 tests.