singerdmx / flutter-quill

Rich text editor for Flutter
https://pub.dev/packages/flutter_quill
MIT License
2.46k stars 779 forks source link

When you enter content at the end, move the cursor to the front, and then perform the undo operation, an error will occur. #1607

Open ddxl123 opened 7 months ago

ddxl123 commented 7 months ago

Is there an existing issue for this?

Flutter Quill version

flutter_quill: ^9.0.1

Other Flutter Quill packages versions

flutter_quill_extensions: ^9.0.1 vsc_quill_delta_to_html: ^1.0.3

Steps to reproduce

  1. write content
  2. move the cursor to the front
  3. undo, undo, undo...
  4. an error will occur

Expected results

normal

Actual results


======== Exception caught by gesture ===============================================================
The following assertion was thrown while handling a gesture:
'dart:ui/text.dart': Failed assertion: line 2520 pos 16: '<optimized out>': is not true.

When the exception was thrown, this was the stack: 
#2      new TextRange.collapsed (dart:ui/text.dart:2520:16)
#3      new TextSelection.collapsed (package:flutter/src/services/text_editing.dart:36:14)
#4      QuillController._handleHistoryChange (package:flutter_quill/src/widgets/quill/quill_controller.dart:241:25)
#5      QuillController.undo (package:flutter_quill/src/widgets/quill/quill_controller.dart:230:7)
#6      QuillToolbarHistoryButtonState._updateHistory (package:flutter_quill/src/widgets/toolbar/buttons/history_button.dart:132:20)
#7      QuillToolbarIconButton.build.<anonymous closure> (package:flutter_quill/src/widgets/toolbar/buttons/quill_icon_button.dart:27:20)
#8      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1183:21)
#9      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:275:24)
#10     TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:652:11)
#11     BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:309:5)
#12     BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:279:7)
#13     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:167:27)
#14     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:492:20)
#15     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:468:22)
#16     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:439:11)
#17     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:413:7)
#18     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:376:5)
#19     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:323:7)
#20     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:292:9)
#21     _invoke1 (dart:ui/hooks.dart:328:13)
#22     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:410:7)
#23     _dispatchPointerDataPacket (dart:ui/hooks.dart:262:31)
(elided 2 frames from class _AssertionError)
Handler: "onTap"
Recognizer: TapGestureRecognizer#48fb3
  debugOwner: GestureDetector
  state: ready
  won arena
  finalPosition: Offset(35.4, 346.0)
  finalLocalPosition: Offset(23.4, 22.6)
  button: 1
  sent tap down
====================================================================================================

======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
The provided text position is not in the current node
'package:flutter_quill/src/widgets/quill/text_line.dart':
Failed assertion: line 1288 pos 12: 'container.containsOffset(position.offset)'

When the exception was thrown, this was the stack: 
#2      RenderEditableTextLine.globalToLocalPosition (package:flutter_quill/src/widgets/quill/text_line.dart:1288:12)
#3      RenderEditor.getLocalRectForCaret (package:flutter_quill/src/widgets/editor/editor.dart:1212:39)
#4      RawEditorStateTextInputClientMixin._updateCaretRectIfNeeded (package:flutter_quill/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart:111:26)
#5      RawEditorStateTextInputClientMixin._updateCaretRectIfNeeded.<anonymous closure> (package:flutter_quill/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart:115:40)
#6      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1325:15)
#7      SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1264:9)
#8      SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1113:5)
#9      _invoke (dart:ui/hooks.dart:312:13)
#10     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:383:5)
#11     _drawFrame (dart:ui/hooks.dart:283:31)
(elided 2 frames from class _AssertionError)
====================================================================================================
I/flutter ( 1086): Drift: Sent SELECT * FROM "fragment_memory_infos" WHERE "be_synced" = ? LIMIT 20; with args [0]
I/flutter ( 1086): Drift: Sent SELECT * FROM "fragment_memory_infos" WHERE "be_synced" = ? LIMIT 20; with args [0]
I/flutter ( 1086): Drift: Sent SELECT * FROM "fragment_memory_infos" WHERE "be_synced" = ? LIMIT 20; with args [0]
I/flutter ( 1086): Drift: Sent SELECT * FROM "fragment_memory_infos" WHERE "be_synced" = ? LIMIT 20; with args [0]
I/flutter ( 1086): Drift: Sent SELECT * FROM "fragment_memory_infos" WHERE "be_synced" = ? LIMIT 20; with args [0]
I/flutter ( 1086): Drift: Sent SELECT * FROM "fragment_memory_infos" WHERE "be_synced" = ? LIMIT 20; with args [0]
I/flutter ( 1086): Drift: Sent SELECT * FROM "fragment_memory_infos" WHERE "be_synced" = ? LIMIT 20; with args [0]
I/flutter ( 1086): Drift: Sent SELECT * FROM "fragment_memory_infos" WHERE "be_synced" = ? LIMIT 20; with args [0]
I/flutter ( 1086): Drift: Sent SELECT * FROM "fragment_memory_infos" WHERE "be_synced" = ? LIMIT 20; with args [0]
I/flutter ( 1086): Drift: Sent SELECT * FROM "fragment_memory_infos" WHERE "be_synced" = ? LIMIT 20; with args [0]

Code sample

any

Screenshots or Video

No response

Logs

No response

EgorK0rshun commented 2 months ago

in 9.3.19 same