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

Fix / Renovate SpecialChars plugin #106

Open
WebCoder49 opened this issue May 28, 2024 · 1 comment
Open

Fix / Renovate SpecialChars plugin #106

WebCoder49 opened this issue May 28, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@WebCoder49
Copy link
Owner

Query

Please let me know here if you have any idea for how to get the width of a character in a textarea element, for use in rendering the character below in the highlighted section with the same width. A canvas solution is already being used, but some arbitrary checks are in place to make it more cross-browser compatible and this is becoming very messy. The code for this is in the special-chars plugin.

Testing

To test the special character view for every character, like in the screenshot below, use new codeInput.plugins.SpecialChars(true, true, /./g).

Status when Writing

  • It doesn't get the right width with Unicode characters like emojis, but it appears fine with all ASCII characters except for Tab (0009):
    ASCII characters
  • It never highlights newlines - maybe this should be made clear / fixed?
  • The rather messy canvas method used to find character width may be the problem.
  • The RegEx for special characters should probably be changed - perhaps it should just match zero-width (­) and -like characters?
@WebCoder49 WebCoder49 added the help wanted Extra attention is needed label May 28, 2024
@WebCoder49
Copy link
Owner Author

WebCoder49 commented Jun 18, 2024

This is truly broken - I tried the same tests on an X11/Ubuntu machine on Chromium and Firefox and it gave different character widths to on a Windows 11 machine.

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

1 participant