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

Fixed bug with emojis and action tag reaction due to incorrect character movement across emojis (Resolves #1882) #1887

Closed
wants to merge 2 commits into from

Conversation

matthew-carroll
Copy link
Contributor

Fixed bug with emojis and action tag reaction due to incorrect character movement across emojis (Resolves #1882)

The issue was that the action tag reaction was assuming, in a couple places, that every character only occupies a single codepoint.

@BazinC
Copy link
Contributor

BazinC commented Mar 9, 2024

Hey @matthew-carroll , your modification in TagFinder won't solve the whole issue with emojis.
See video below captured on your branch.

emoji-bug.mp4
  • Action Tag example
  • Type emoji '💙' -> ok
  • Move the cursor back one character, before the emoji
  • Type the action trigger character '/'
  • TagFinder leads to not well-formed UTF-16

Can you please consider reviewing my PR here, which solves both issues? Thank you :)

Copy link
Collaborator

@angelosilvestre angelosilvestre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably take a look at @BazinC 's PR.

Comment on lines +69 to +72
while (nextCharacterOffset != null && nextCharacterOffset < rawText.length) {
if (nextCharacterOffset >= rawText.length) {
break;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this if statement necessary? We already check this in the while condition.

Comment on lines +654 to +656
group("emojis >", () {
// Based on bug https://github.com/superlistapp/super_editor/issues/1882
testWidgetsOnArbitraryDesktop("can appear at the beginning of text", (tester) async {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this test belongs to this file? It seems we don't do anything related to tags in this test.

@matthew-carroll
Copy link
Contributor Author

I'm gonna close this in favor of #1879 where we'll attempt to review and merge a different fix for the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emoji at beginning of paragraphs cause problems with Tags
3 participants