WebCoder49 / code-input

Fully customisable, editable, syntax-highlighted textareas + plugins
https://css-tricks.com/creating-an-editable-textarea-that-supports-syntax-highlighted-code/
MIT License
171 stars 23 forks source link

Fix / Renovate SpecialChars plugin #106

Open WebCoder49 opened 5 months ago

WebCoder49 commented 5 months ago

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

WebCoder49 commented 4 months ago

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.