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

fix position translation at EOF with softwrap #5786

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

pascalkuthe
Copy link
Member

@pascalkuthe pascalkuthe commented Feb 2, 2023

Fixes #5782

The new rendering code added in #5420 performs char_idx -> visual_pos translations on the fly for performance reasons. This code needs a special case for the EOF character as that character is not a real char_idx in the text (it's rendered as virtual text but virtual text normally doesn't have a separate char_idx). When softwrap is enabled the view may be offset multiple visual lines from the start of the line. That means that any position needs to have a vertical offset applied (pos.row -= row_offset). This is always done for all graphemes that get actually rendered but because the EOF position takes a specical branch (only used for position translation) it needs to be done there too (which was missed so far).

@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. labels Feb 2, 2023
@archseer archseer merged commit 2949bb0 into helix-editor:master Feb 2, 2023
@pascalkuthe pascalkuthe deleted the fix_eof_cursor_softwrap branch February 2, 2023 18:19
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 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.

Rendering error, cursor moves below the text as you type.
2 participants