kpdecker / jsdiff

A javascript text differencing implementation.
BSD 3-Clause "New" or "Revised" License
7.75k stars 491 forks source link

Add function glyphDiff for emoji and higher UTF8 character support #461

Closed alexander-riss closed 4 months ago

alexander-riss commented 6 months ago

the character diff currently does not handle high utf8 like emoji as their length is not calculated correctly. instead of breaking the old characterDiff method we now have a glyphDiff method for this purpose as it may perform worse than the existing method. this PR extends the test suite and passes with 100% coverage

ExplodingCabbage commented 4 months ago

I figured I'd rather do a breaking release making this change in diffChars (change already done via https://github.com/kpdecker/jsdiff/pull/500). Diffing UTF-16 code units is a pretty arbitrary and non-useful thing to do and I think it's better to simply have a single diffChars method that does the useful thing.