futurecoder icon indicating copy to clipboard operation
futurecoder copied to clipboard

cursor position misalignment for Unicode characters

Open tueda opened this issue 3 years ago • 1 comments

Maybe it depends on the browser font settings, but I experienced an issue with the cursor position in the editor for some Unicode characters, which does not look correctly calculated. For example:

print('⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪')  # MEDIUM WHITE CIRCLE U+26AA
print('❎❎❎❎❎❎❎❎❎❎')  # NEGATIVE SQUARED CROSS MARK U+274E
print('○○○○○○○○○○')  # WHITE CIRCLE U+25CB

In Chrome/Edge, the cursor position is not correct for these characters (in all the three lines): image but somehow in Firefox the "WHITE CIRCLE"s in the last line are displayed correctly with (I think) a fixed-width font. image

In the shell, I have no problem.

tueda avatar Jun 20 '22 07:06 tueda

Thanks for the report, this is new to me. It seems to be an unresolved problem with the ace editor. I can reproduce it in the official demo on https://ace.c9.io/. Looks like it's been reported here and isn't likely to get fixed. I think you're right that this is about fixed width fonts - the misaligned characters are bigger than ASCII characters.

I think solving this requires switching from Ace to a different editor library such as CodeMirror.

alexmojaki avatar Jun 20 '22 09:06 alexmojaki