Fix lua-objc mapping to handle high/low surrogate pairs in hs.styledtext #3356
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses issues in #3219
Completely rewrites lua-objc index mapping to properly handle UTF16 High/Low surrogate pairs
UTF8 (which Lua uses) can have Unicode characters of 1-4 bytes
UTF16 (which Objective-C/Swift use) are always 2 bytes, but for Unicode characters above U+10000 inclusive, 2 UTF16 characters (i.e. 4 bytes) are used.
This code assumes that no 1-byte UTF8 character can be a surrogate member... as far as I can tell this is a safe assumption, but I haven't found an explicit statement to that effect, so if anyone knows otherwise, please chime in.