AvaloniaUI / AvaloniaEdit

Avalonia-based text editor (port of AvalonEdit)
MIT License
774 stars 149 forks source link

`0xFEFF` (ZWNBSP) is not correctly handled #431

Open Rekkonnect opened 5 months ago

Rekkonnect commented 5 months ago

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.

mgarstenauer commented 5 months ago

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.