Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5016d99

Browse files
committed
Update deletion comment
1 parent 38de851 commit 5016d99

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/web_ui/lib/src/engine/text_editing/text_editing.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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) {

0 commit comments

Comments
 (0)