Space drawing: option to show control characters
Enhancement proposal
Some control characters, like special spaces or bidirectional controls, are not visible by default. It's not good for a source editor, because they can alter the meaning of the code without being noticed.
Typical issues:
- copying some code from HTML may contain special spaces, like
U+2003
after a bullet point, that may lead to hard-to-spot build errors. - bidir commands can be used to inject hidden malicious code (see https://github.com/nickboucher/trojan-source or https://code.visualstudio.com/updates/v1_63#_unicode-highlighting for details and examples).
Possible solutions:
- Pango provides a
PANGO_SHOW_IGNORABLES
attribute (see https://docs.gtk.org/Pango/flags.ShowFlags.html ), can be applied to the whole SourceView using a Tag, but this approach requires to track the content of the buffer to reapply the Tag when text is added --> not convenient. - I tried to use the default style of the GtkTextView and proposed a MR (see gtk!5707 (closed)), but GTK devs are reluctant to add new APIs.
- Is it something the GtkSource.SpaceDrawer could support?
🙂