Skip to content

If the string contains Unicode Emoji, the index will be misaligned. #27

Open
@tioken

Description

@tioken

Hello, thanks for this useful library!

I'd like to report a bug that I encountered while using it.

 json0diff(['Hello'], ['🤗Hello🤗'], DiffMatchPatch, json1, textUnicode);
// Outputs => [0,{"es":["🤗",6,"🤗"]}]

When this is passed to the apply method of json1, an error message Error: The op is too long for this document will be displayed.

It seems that text-unicode treats emoji as a single character.
changing the index from 6 to 5 works fine.

 [0,{"es":["🤗",5,"🤗"]}]

If it is possible, could you please fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions