Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Conversation

SamSaffron
Copy link
Member

Previous to this fix we would diff the entire body of text, this
could lead to situations where a diff presented to a user was
wildly off matching areas in the text that should not have been
tested.

New algorithm only checks a portion of the string, this ensures
that during streaming there is no chance for wild mistakes

Previous to this fix we would diff the entire body of text, this
could lead to situations where a diff presented to a user was
wildly off matching areas in the text that should not have been
tested.

New algorithm only checks a portion of the string, this ensures
that during streaming there is no chance for wild mistakes
Copy link
Contributor

@nattsw nattsw left a comment

Choose a reason for hiding this comment

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

This looks ok, good testing. I'm not sure if we'd want to add more test cases e.g.

  • original = "hello", target = "" (all text removed)
  • original = "hi cat", target = "hi cat" (whitespace)
  • original = "🏴‍☠️", target = "🏴" (zwj emojis)

@SamSaffron
Copy link
Member Author

Agree we can expand this

@SamSaffron SamSaffron merged commit 55dab9c into main May 22, 2025
6 checks passed
@SamSaffron SamSaffron deleted the improve-diff-flash branch May 22, 2025 06:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants