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

[Windows] [Chrome] Cursor display position and input position are mismatched #24

Closed
Seasawher opened this issue Apr 27, 2024 · 8 comments

Comments

@Seasawher
Copy link

Seasawher commented Apr 27, 2024

I just can't solve it. I'm so confused.

When you try to define longlonglong....name, there was a problem with the cursor "lagging" behind the displayed character.

see #7 (comment)

The bug seems to be caused by a difference between the character width used to calculate the assumed cursor position and the actual character width of the font.

But I don't know how to solve it...

Test Result

  • It cannot be reproduced if the OS is Mac.
  • Clearing the cache and reloading doesn't help.
  • If font is consolas, alphabetic characters are not mismatched, but double-byte characters are mismatched.
  • If the font is JuliaMono, full-width characters are not mismatched, but alphabetic characters are mismatched.
  • No problem in firefox.

My Environment

  • OS: Windows 11 Home
  • Browser: latest Chrome
@aconite-ac
Copy link

I found the same problem which @Seasawher reported occurs in my similar environment.

Test Result

  • Before loading font for displaying source code, this problem doesn't occur.
  • When typing a long name such as aaaaaaaaaaaa... , this cursor lagging becomes more serious.
  • When viewing a code of markdown file on GitHub, if cursor points a emphasized long sentence, the same problem occurs.
  • Both lean4web problem and GitHub problem doesn't occur in firefox.
    (So, it may be a Chrome or Windows problem rather than a lean4web-unique problem.)

My Environment

  • OS: Windows 11 Home
  • Browser: latest Chrome

@joneugster
Copy link
Collaborator

@aconite-ac so you say you observe this in github too, so completely independend of lean4web?

Could it be a bug in the monaco editor?

@joneugster
Copy link
Collaborator

Old issues online suggest using monaco.editor.remeasureFonts() once after the font's done loading. I'll try that tomorrow.

@aconite-ac
Copy link

@joneugster
I'm not sure their problems about lean4web and GitHub occurs similarly in other environment,
because of my environment is based on Japanese language.

I should have written about it.

Anyway, I thank you for your considering!
I hope this suggestion may solve the problem.

joneugster added a commit that referenced this issue May 14, 2024
@joneugster
Copy link
Collaborator

joneugster commented May 14, 2024

@Seasawher @aconite-ac could you test the fix that is live on https://lean.math.hhu.de , please?

@Seasawher
Copy link
Author

I have tested it, and this issue seems to be resolved.

Thanks!

@aconite-ac
Copy link

@joneugster
I have tested it too by long aaaaaaaaaaaa... , some double-byte character , some emoji.
And I found that this issue doesn't occur now.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants