dmonad / lib0

Monorepo of isomorphic utility functions
MIT License
345 stars 63 forks source link

Handle surrogate pairs in diff #45

Closed KentoMoriwaki closed 1 year ago

KentoMoriwaki commented 1 year ago

fix https://github.com/yjs/yjs/issues/303

Current diff algorithm may produce invalid combinations of surrogate pair. To avoid this, we can use Array.from to calculate the length and index in safe.

This changes may cause performance degradation, so we have an option to implement this in another function. IMO it is better to be able to handle surrogate pairs correctly in all situations.

KentoMoriwaki commented 1 year ago

@dmonad Cloud you take a look?

KentoMoriwaki commented 1 year ago

I've implemented another version: more performant and simpler, but there is a trade-off. #46 You can choose which one you prefer.

HondryTravis commented 1 year ago

same question!

Young6118 commented 1 year ago

This worked for me, please merge into the master branch! please! ! ! 🙏

dmonad commented 1 year ago

Closed in favor of #46