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

[pulsar-next] Character width measurement is incorrect on Electron 30 #1102

Open
5 tasks done
savetheclocktower opened this issue Sep 21, 2024 · 0 comments
Open
5 tasks done
Assignees
Labels
bug Something isn't working pulsar-next Related to the version of Pulsar that runs on the latest Electron

Comments

@savetheclocktower
Copy link
Contributor

savetheclocktower commented Sep 21, 2024

Thanks in advance for your bug report!

  • Have you reproduced issue in safe mode?
  • Have you used the debugging guide to try to resolve the issue?
  • Have you checked our FAQs to make sure your question isn't answered there?
  • Have you checked to make sure your issue does not already exist?
  • Have you checked you are on the latest release of Pulsar?

What happened?

On newer Electron, the text editor soft-wraps too early because TextEditor thinks that an individual character is wider than it actually is.

Screenshot 2024-09-20 at 5 35 16 PM

These four characters are rendered hidden (I've just made them visible for illustration) and are used as examples of the width of a “normal” character, a double-width character, a half-width character, and a Korean character, respectively.

But with identical font settings, PulsarNext thought the character that had these metrics on Pulsar 1.121…

Screenshot 2024-09-20 at 5 38 58 PM

…was a bit wider and taller:

Screenshot 2024-09-20 at 5 38 45 PM

After some experimentation, I found that this is a side-effect of the x sharing a line with other characters — if I delete the other three, the span with the x reverts to the width we expect.

So we can isolate the four characters in different block-level elements to eliminate any possible effects on one another. We should also change the metric that computes the editor line height by having it measure each of those four block elements and picking the tallest one.

I know this will get lost in the weeds unless I write it down here; this is basically a note to my future self.

Pulsar version

some weird version with Electron 30

Which OS does this happen on?

❓ Other(Please specify in the OS details field below)

OS details

N/A

Which CPU architecture are you running this on?

None

What steps are needed to reproduce this?

  • Enable soft wrap
  • Don't worry, you'll see it

Additional Information:

No response

@savetheclocktower savetheclocktower added the bug Something isn't working label Sep 21, 2024
@savetheclocktower savetheclocktower self-assigned this Sep 21, 2024
@savetheclocktower savetheclocktower added the pulsar-next Related to the version of Pulsar that runs on the latest Electron label Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pulsar-next Related to the version of Pulsar that runs on the latest Electron
Projects
None yet
Development

No branches or pull requests

1 participant