This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
lib/web_ui/lib/src/engine/text_editing Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -477,7 +477,7 @@ class TextEditingDeltaState {
477477 /// If the deletion is backward, the length is susbtracted from the [deltaEnd]
478478 /// that we set when beforeinput was fired to determine the [deltaStart] .
479479 /// If the deletion is forward, [deltaStart] is set to the new editing state baseOffset
480- /// and [deltaEnd] is [deltaStart] incremented by the length of the deletion.
480+ /// and [deltaEnd] is set to [deltaStart] incremented by the length of the deletion.
481481 ///
482482 /// For a replacement at a selection we set the [deltaStart] to be the beginning of the selection
483483 /// from the last editing state.
@@ -498,7 +498,10 @@ class TextEditingDeltaState {
498498 if (isTextBeingRemoved) {
499499 // When text is deleted outside of the composing region or is cut using the native toolbar,
500500 // we calculate the length of the deleted text by comparing the new and old editing state lengths.
501- // This value is then subtracted from the end position of the delta to capture the deleted range.
501+ // If the deletion is backward, the length is susbtracted from the [deltaEnd]
502+ // that we set when beforeinput was fired to determine the [deltaStart].
503+ // If the deletion is forward, [deltaStart] is set to the new editing state baseOffset
504+ // and [deltaEnd] is set to [deltaStart] incremented by the length of the deletion.
502505 final int deletedLength = newTextEditingDeltaState.oldText.length - newEditingState.text! .length;
503506 final bool backwardDeletion = newEditingState.baseOffset != lastEditingState? .baseOffset;
504507 if (backwardDeletion) {
You can’t perform that action at this time.
0 commit comments