Skip to content

Distracting and confusing cursor offset #549

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

Closed
jebrosen opened this issue Dec 10, 2019 · 6 comments
Closed

Distracting and confusing cursor offset #549

jebrosen opened this issue Dec 10, 2019 · 6 comments
Labels
upstream Caused by a third-party component

Comments

@jebrosen
Copy link

jebrosen commented Dec 10, 2019

Platform: Linux, Firefox version 72.0b4. Chromium appears to be fine.

Screenshot: https://paste.rs/pxS.png (the cursor is positioned on line 12 after the space, but is visually inside it).

Since some time in the last few weeks, I noticed that the cursor sometimes gets offset from the text insert position. When it's bad enough, Backspace deletes the character visually in front of the cursor instead of behind it making editing very frustrating and error-prone.

It seems to be somehow related to the vertical dotted-line indentation hints, as lines with more of these have a worse offset.

I will try bisecting Firefox builds but that might be a while; hopefully others can help reproduce or narrow down the necessary conditions.

@shepmaster shepmaster added the upstream Caused by a third-party component label Dec 10, 2019
@shepmaster
Copy link
Member

We haven't made any changes that would affect this in the last few weeks / months. I'd recommend looking through the Ace editor issues to see if anyone else has reported issues.

@shepmaster
Copy link
Member

You may also want to see if you can reproduce your issue on the Ace demo page.

@jebrosen
Copy link
Author

I can reproduce it on that demo page, but only if I manually set a few elements to have font-family: "Source Code Pro" like is used in the playground. Thanks for that pointer; I'll keep playing with it a bit and see what I can find.

@shepmaster
Copy link
Member

only if I manually set a few elements to have font-family: "Source Code Pro"

Hmm. See also #112 and #509. We might be using Ace incorrectly or in a non-supported manner, or that specific font may have issues. You may also want to see if your local version of the font has become corrupted in some fashion (detailed in #112).

@jebrosen
Copy link
Author

I have found a workaround. On Arch adobe-source-code-pro-fonts is a transitive dependency of gtk3 so it's pretty much guaranteed to be installed. However, Arch only packages the OTF version of the fonts. After installing the whole font package (https://github.com/adobe-fonts/source-code-pro/releases/tag/2.030R-ro%2F1.050R-it) to ~/.local/share/fonts/ and restarting Firefox, everything works nicely again.

I have no idea why that fixes it, though. Maybe Firefox prefers the TTF version and it happens to be better in some way. Whatever wrong thing happens with the OTF fonts, I think this is a duplicate of the many issues related to the way the Ace Editor calculates its cursor position and not something rust-playground can really fix.

@shepmaster
Copy link
Member

Interesting! Thank you for the investigation and feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream Caused by a third-party component
Projects
None yet
Development

No branches or pull requests

2 participants