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

When entering text, selecting all, and then using Command+Z to undo results in an error.

Open lingyun000 opened this issue 2 years ago • 4 comments

Is there an existing issue for this?

Flutter Quill version

9.0+

Other Flutter Quill packages versions

No response

Steps to reproduce

When entering text, selecting all, and then using Command+Z.

Expected results

undo

Actual results

error

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Xnip2023-12-22_11-06-57

Logs

Logs
Restarted application in 584ms.

════════ Exception caught by services library ══════════════════════════════════
The following assertion was thrown while processing the key message handler:
'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:254:25)
#5      QuillController.undo (package:flutter_quill/src/widgets/quill/quill_controller.dart:243:7)
#6      QuillEditorUndoKeyboardAction.invoke (package:flutter_quill/src/widgets/raw_editor/raw_editor_actions.dart:364:24)
#7      _OverridableContextAction.invokeDefaultAction (package:flutter/src/widgets/actions.dart:1811:28)
#8      _OverridableActionMixin.invoke (package:flutter/src/widgets/actions.dart:1676:9)
#9      Action._invoke (package:flutter/src/widgets/actions.dart:336:19)
#10     ActionDispatcher.invokeActionIfEnabled (package:flutter/src/widgets/actions.dart:666:28)
#11     ShortcutManager.handleKeypress (package:flutter/src/widgets/shortcuts.dart:851:83)
#12     _ShortcutsState._handleOnKey (package:flutter/src/widgets/shortcuts.dart:1042:20)
#13     _HighlightModeManager.handleKeyMessage (package:flutter/src/widgets/focus_manager.dart:1837:32)
#14     KeyEventManager._dispatchKeyMessage (package:flutter/src/services/hardware_keyboard.dart:996:34)
#15     KeyEventManager.handleRawKeyMessage (package:flutter/src/services/hardware_keyboard.dart:1061:17)
#16     BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:223:49)
#17     _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:567:35)
#18     _invoke2 (dart:ui/hooks.dart:344:13)
#19     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:45:5)
#20     _Channel.push (dart:ui/channel_buffers.dart:135:31)
#21     ChannelBuffers.push (dart:ui/channel_buffers.dart:343:17)
#22     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:722:22)
#23     _dispatchPlatformMessage (dart:ui/hooks.dart:257:31)
(elided 2 frames from class _AssertionError)

KeyMessage: KeyMessage([KeyDownEvent#c441f(physicalKey: PhysicalKeyboardKey#c222c(usbHidUsage: "0x0007001d", debugName: "Key Z"), logicalKey: LogicalKeyboardKey#5989a(keyId: "0x0000007a", keyLabel: "Z", debugName: "Key Z"), character: "z", timeStamp: 19:19:03.247687)])
════════════════════════════════════════════════════════════════════════════════

lingyun000 avatar Dec 22 '23 03:12 lingyun000

Hi @lingyun000, can you switch to the new branch fix/text-selection-exception and tell me if it fix the issue for you?

EchoEllet avatar Dec 22 '23 12:12 EchoEllet

The current test is fine.

lingyun000 avatar Dec 23 '23 01:12 lingyun000

The current test is fine.

So does it solve the problem for you?

EchoEllet avatar Dec 30 '23 12:12 EchoEllet

Yes, the answer solves the problem.

---- Replied Message ---- | From | Ellet @.> | | Date | 12/30/2023 20:36 | | To | singerdmx/flutter-quill @.> | | Cc | lingyun000 @.>, Mention @.> | | Subject | Re: [singerdmx/flutter-quill] When entering text, selecting all, and then using Command+Z to undo results in an error. (Issue #1641) |

The current test is fine.

So does it solve the problem for you?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

lingyun000 avatar Dec 30 '23 12:12 lingyun000

When will the code be merged?

lingyun000 avatar Jan 16 '24 02:01 lingyun000

When will the code be merged?

I'm not sure if it cause any other bugs I need someone expert in this repo to review the code and the bug, and then we will decide if it should be merged or not

EchoEllet avatar Jan 16 '24 08:01 EchoEllet

Can you expedite the review? This is a critical issue on PC.

lingyun000 avatar Jan 22 '24 06:01 lingyun000

Can you review this @adil192? this feature was introduced by you and I can't really understand it, I did a workaround to fix the exception and that's all I can do

EchoEllet avatar Jan 22 '24 13:01 EchoEllet