AvaloniaEdit icon indicating copy to clipboard operation
AvaloniaEdit copied to clipboard

`0xFEFF` (ZWNBSP) is not correctly handled

Open Rekkonnect opened this issue 1 year ago • 1 comments

This is a character commonly found in UTF-16-encoded sources. It is not specifically shown within a box when the option ShowBoxForControlCharacters is enabled.

Rekkonnect avatar Jun 05 '24 14:06 Rekkonnect

It looks like AvaloniaEdit is calling Char.IsControl to determine whether the character is a control character.

https://github.com/AvaloniaUI/AvaloniaEdit/blob/master/src/AvaloniaEdit/Rendering/SingleCharacterElementGenerator.cs#L93C42-L93C59

Based on that definition 0xFEFF is not a control character.

VS Code also doesn't treat 0xFEFF as a control character, but it renders it as (unrecognized character). VS Code highlights the character when Editor > Unicode Highlight: Invisible Characters is enabled.

Looks ShowBoxForControlCharacters is working as intended and a new feature is needed handle those kind of characters.

mgarstenauer avatar Jun 06 '24 18:06 mgarstenauer