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

Very long lines of code become misaligned #89

Open
WebCoder49 opened this issue Mar 28, 2024 · 5 comments
Open

Very long lines of code become misaligned #89

WebCoder49 opened this issue Mar 28, 2024 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@WebCoder49
Copy link
Owner

Screenshot
Reproduce this by copy-pasting the Google.com homepage into Neattribute.

@proatwork
Copy link

try letter-spacing: 0 on code-input > pre

@WebCoder49
Copy link
Owner Author

WebCoder49 commented May 27, 2024

try letter-spacing: 0 on code-input > pre

Thanks for the suggestion, but it didn't work. The bug:

  • Persists no matter the letter-spacing I apply to code-input textarea, code-input pre, code-input pre *, with !important or without it.
  • Occurs in Chromium (MS Edge 125.0.2535.51 (Official build) (64-bit) / Google Chrome 125.0.6422.112 (Official Build) (64-bit) (cohort: M125 Rollout)), but not in Firefox (Developer Edition 127.0b5 (64-bit))
  • Appears to be due to the characters being very slightly wider in the textarea than in the highlighted pre code element.
  • Occurs more so in Prism.js than in highlight.js on the example above, but does occur in both.

@WebCoder49
Copy link
Owner Author

In Chrome DevTools with Prism.js, this code makes the alignment correct at the far left and far right sides of the example, but in the middle the highlighted code (pre code) is still further to the right than the editable code (textarea).

code-input pre * {
    letter-spacing: 0.0005px;
}

@WebCoder49
Copy link
Owner Author

Setting the text-rendering property to any consistent value on code-input textarea, code-input pre, code-input pre * doesn't seem to work.

@WebCoder49 WebCoder49 added the help wanted Extra attention is needed label May 27, 2024
@WebCoder49
Copy link
Owner Author

I'm not sure how to fix this bug; I'll leave it now because it's very much of an edge-case but if you have any idea of how it could be fixed please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants