flutter-quill icon indicating copy to clipboard operation
flutter-quill copied to clipboard

Assertion fails for swipe typing + Undo (Android)

Open Alspb opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

Flutter Quill version

master

Steps to reproduce

  1. Open an empty editor window.
  2. Enter "Test text" using swipe typing.
  3. Press undo.

Expected results

No assertion failures.

Actual results

The following assertion fails:

TextPosition globalToLocalPosition(TextPosition position) {
    assert(container.containsOffset(position.offset),
        'The provided text position is not in the current node');
    return TextPosition(
      offset: position.offset - container.documentOffset,
      affinity: position.affinity,
    );
}

When adding print( 'position.offset=${position.offset}, container.containsOffset(position.offset)=${container.containsOffset(position.offset)}'); before assert it prints

position.offset=4, container.containsOffset(position.offset)=true

several times after Undo was pressed but then for some reason it prints

position.offset=5, container.containsOffset(position.offset)=false

and then the assert statement fails.

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Assert swipe typing undo.webm

Logs

Logs
[Paste your logs here]

Alspb avatar May 20 '24 23:05 Alspb