Skip to content
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

don't manually grapheme align ts highlights #10310

Merged
merged 1 commit into from Apr 10, 2024
Merged

Conversation

pascalkuthe
Copy link
Member

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

@pascalkuthe pascalkuthe added C-bug Category: This is a bug E-easy Call for participation: Experience needed to fix: Easy / not much A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer. C-perf labels Apr 8, 2024
helix-term/src/ui/document.rs Outdated Show resolved Hide resolved
helix-term/src/ui/document.rs Outdated Show resolved Hide resolved
helix-term/src/ui/editor.rs Show resolved Hide resolved
helix-term/src/ui/document.rs Show resolved Hide resolved
helix-stdx/src/rope.rs Outdated Show resolved Hide resolved
helix-term/src/ui/document.rs Outdated Show resolved Hide resolved
helix-term/src/ui/document.rs Outdated Show resolved Hide resolved
@archseer archseer merged commit 73d26d0 into master Apr 10, 2024
6 checks passed
@archseer archseer deleted the non_unicode_crash branch April 10, 2024 15:14
postsolar pushed a commit to postsolar/helix that referenced this pull request Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug C-perf E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helix crashes after inputing emojies.
3 participants