-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
area:existing-pluginA bug/feature for an existing plugin in the plugins folder of code-input.A bug/feature for an existing plugin in the plugins folder of code-input.bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is neededpriority:low
Milestone
Description
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):
- 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?
Metadata
Metadata
Assignees
Labels
area:existing-pluginA bug/feature for an existing plugin in the plugins folder of code-input.A bug/feature for an existing plugin in the plugins folder of code-input.bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is neededpriority:low