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

Improve text width calculation precision #1408

Merged

Conversation

Guldoman
Copy link
Member

@Guldoman Guldoman commented Mar 4, 2023

In some extreme cases (~30000 chars), text width precision takes a hit. Using double instead of float fixes that.

To repro the issue:

  1. Open a new file (must be plaintext)
  2. Write ~30000 chars
  3. Notice that the caret position is wrong.

Another possible solution would be to force the tokenizer to split long strings, so that we never calculate the width of extremely long strings.

There might be a performance impact, but I haven't tested that yet.

In some extreme cases (~30000 chars) text width precision takes a hit.
Using double instead of float fixes that.
@Guldoman Guldoman force-pushed the PR_improve_text_width_precision branch from f0b3af5 to 862a2da Compare March 4, 2023 19:29
@adamharrison adamharrison merged commit ed9bb3c into lite-xl:master Mar 9, 2023
takase1121 pushed a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
In some extreme cases (~30000 chars) text width precision takes a hit.
Using double instead of float fixes that.
takase1121 pushed a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
In some extreme cases (~30000 chars) text width precision takes a hit.
Using double instead of float fixes that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants