Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji at beginning of paragraphs cause problems with Tags #1882

Closed
brian-superlist opened this issue Mar 6, 2024 · 0 comments · Fixed by #2046
Closed

Emoji at beginning of paragraphs cause problems with Tags #1882

brian-superlist opened this issue Mar 6, 2024 · 0 comments · Fixed by #2046
Assignees
Labels
area_supereditor Pertains to SuperEditor bounty_junior customer_superlist Needed by Superlist f:superlist Funded by Superlist time: 5 type_bug Something isn't working

Comments

@brian-superlist
Copy link
Contributor

Package Version

  1. super_editor main channel
  2. Flutter main latest

To Reproduce
Steps to reproduce the behavior:

  1. Launch the example app on macos
  2. Go to the Action Tags demo
  3. Try to insert the 🔴 emoji
  4. See the error

Actual behavior
No emoji is inserted. Error thrown (see below)

Expected behavior
The emoji is inserted correctly.

Platform
macOS

Flutter version

[!] Flutter (Channel main, 3.20.0-17.0.pre.99, on macOS 14.2.1 23C71 darwin-arm64, locale en-US)
Dart SDK version: 3.4.0-190.0.dev (dev) (Thu Feb 29 08:14:33 2024 -0800) on "macos_arm64"

Error

======== Exception caught by services library ======================================================
The following _TypeError was thrown during method call TextInputClient.updateEditingStateWithDeltas:
Null check operator used on a null value

When the exception was thrown, this was the stack: 
#0      TagFinder.findTagAroundPosition (package:super_editor/src/default_editor/text_tokenizing/tags.dart:40:95)
#1      ActionTagComposingReaction.react (package:super_editor/src/default_editor/text_tokenizing/action_tags.dart:299:37)
#2      Editor._reactToChanges (package:super_editor/src/core/editor.dart:218:16)
#3      Editor.execute (package:super_editor/src/core/editor.dart:161:9)
#4      TextDeltasDocumentEditor._insertPlainText (package:super_editor/src/default_editor/document_ime/document_delta_editing.dart:342:12)
#5      TextDeltasDocumentEditor.insert (package:super_editor/src/default_editor/document_ime/document_delta_editing.dart:294:23)
#6      TextDeltasDocumentEditor._applyInsertion (package:super_editor/src/default_editor/document_ime/document_delta_editing.dart:171:5)
#7      TextDeltasDocumentEditor.applyDeltas (package:super_editor/src/default_editor/document_ime/document_delta_editing.dart:80:9)
#8      DocumentImeInputClient.updateEditingValueWithDeltas (package:super_editor/src/default_editor/document_ime/document_ime_communication.dart:219:30)
#9      DeltaTextInputClientDecorator.updateEditingValueWithDeltas (package:super_editor/src/default_editor/document_ime/ime_decoration.dart:129:14)
#10     TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1892:63)
#11     TextInput._loudlyHandleTextInputInvocation (package:flutter/src/services/text_input.dart:1781:20)
#12     MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:571:55)
#13     MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:564:34)
#14     _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:581:35)
#15     _invoke2 (dart:ui/hooks.dart:344:13)
#16     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:45:5)
#17     _Channel.push (dart:ui/channel_buffers.dart:135:31)
#18     ChannelBuffers.push (dart:ui/channel_buffers.dart:343:17)
#19     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:750:22)
#20     _dispatchPlatformMessage (dart:ui/hooks.dart:257:31)
call: MethodCall(TextInputClient.updateEditingStateWithDeltas, [28, {deltas: [{selectionBase: 4, oldText: . , selectionAffinity: TextAffinity.downstream, deltaEnd: 2, deltaText: 🔴, deltaStart: 2, composingExtent: -1, selectionIsDirectional: false, selectionExtent: 4, composingBase: -1}]}])
====================================================================================================

Additional context
Using tags, we are also seeing this in Superlist when you:

  1. Insert an emoji at the beginning of a paragraph
  2. Press left arrow key (to move the arrow before the emoji)
  3. The same findTagAroundPosition throws an error
@brian-superlist brian-superlist added type_bug Something isn't working customer_superlist Needed by Superlist f:superlist Funded by Superlist labels Mar 6, 2024
@matthew-carroll matthew-carroll self-assigned this Mar 8, 2024
matthew-carroll added a commit that referenced this issue Mar 9, 2024
BazinC added a commit to BazinC/super_editor that referenced this issue Mar 12, 2024
matthew-carroll added a commit that referenced this issue May 28, 2024
…1882) (#2046)

Co-authored-by: Corentin Bazin <crntnbzn@gmail.com>
github-actions bot pushed a commit that referenced this issue May 28, 2024
matthew-carroll added a commit that referenced this issue May 28, 2024
…1882) (#2046)

Co-authored-by: Corentin Bazin <crntnbzn@gmail.com>
quaaantumdev pushed a commit to quaaantumdev/super_editor that referenced this issue Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment