Skip to content

fix : fix broken prefix and suffix diffs generation inside addContext() #4

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

Merged
merged 1 commit into from
Oct 7, 2022

Conversation

michal-kurz
Copy link
Collaborator

Moved code here from this pr: #3

@michal-kurz michal-kurz force-pushed the fix-surrogate-pairs-in-text-fns branch from d9948ae to 7751a1c Compare October 7, 2022 13:27
@michal-kurz
Copy link
Collaborator Author

Message by @dmsnell copied from original PR: @michal-kurz good catch on this. there's something else to consider here: considering that we're pulling in extra characters into the patch context, I guess there's still a possibility we might crash if the input document contains a series of surrogate halves. it might be that the existing fixup makes the same assumption, that if we shift one character we'll not find another lone low or high surrogate. just wanted to point it out.

Yes, I'm aware - but I believe this should always work as long as the input is valid. I also believe this also applies to your original solution for toDelta.

Fortunately for me, this is good enough for our use-case, as our app is not publicly accessible, and we are in direct contact with all our users - If our user somehow copies a naked surrogate pair (or other invalid text) into our text field, it's not a huge deal in our case. I don't expect this to ever happen, and if it does, then we will deal with it manually, or decide to fix this.

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.

1 participant