don't manually grapheme align ts highlights #10310
Merged
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.
Closes #6645
I have known the root cause of #6645 for a while: The c grammar has a bug where it sometimes creates non-grapheme aligned highlight spans when cealing with unicode characters like emojois.
This caused crashes because our grapheme alignment code couldn't deal with non-char aligned offsets. I think that is the right (potentially only valid) choice for doing grapheme alignment.
In our case it was unfortunate as it leads to crashes. I also wanted to get rid of this grapheme alignment anyway because we already render the text one grapheme at a time, so it's really unnecessary to do this. However, in the past it wasn't possible to remove the alignment because the additional highlight iterators merged on top of the base iterator were using char indexing/grapheme aligned indexes. Just switching the TS iterator would have caused highlighting bugs.
However, recently the overlay and base highlights were decoupled so now the base highlights are seperate, and it was possible to convert the base iterator to using byte indexing instead