Skip to content

Treat 0x0000 to 0x001F as non-printable

Gary Wang requested to merge garywang/ktexteditor:non-printable-take-1 into master

This MR is related to the feature mentioned in !698 (merged) 's description, intended to bring support to display often-to-see non-printable control characters in the text document.

The feature itself can be considered as one of the deal breakers for Notepad++-style users to switch to Kate. see https://www.reddit.com/r/kde/comments/1boo570/kate_is_there_a_way_to_display/

This MR only adds the most basic control characters to the regex, so it can at least be rendered as a red rectangle when Show Non-Printable Spaces is toggled. My final goal (after this MR) is to see the possibility to render these control characters the same way as what Scintilla (the editor component that Notepad++ uses) does, but currently have no clue on how to achieve it, so any related help is appreciated!

The following screenshot shows the current state:

  • Left: Kate with this patch applied to KF6TextEditor, Show Non-Printable Spaces turned on.
  • Middle: Unpatched Kate, Show Non-Printable Spaces turned on.
  • Right: Notepad++, Show All Characters turned on.

image

The content of the text document:

sampledocument.txt

Links that might related:

Edited by Gary Wang

Merge request reports

Loading