Display control characters as empty character or as spacing
-
Notepad++ uses Scintilla which displays control characters as rectangle with text.
I want an option to not show these characters and to have option to replace it with space.
I tried View->Show Symbol->Show whitespace and tabs
But it didn’t help.
Notepad++ still displays nul character as ‘NUL’.Is there option to do this ?
-
If you have PythonScript plugin installed, go to the
Plugins > PythonScript > Show Consoleand type:editor.clearRepresentation("\x00")in the
>>>line, and hit RUN. This should make the NUL display as a blank character. To display NULs per NPP’s normal,editor.setRepresentation("\x00", "NUL")If that works for you, use the
Plugins > PythonScript > New Script, create a script “Display NULs as SPACEs”, which contains just that first line. (I’d also make a second script “Display NULs as NUL” to be able to revert to normal display)If you use
Plugins > Python Script > Configuration, you can then put those scripts into the mainMacromenu, and usingSettings > Shortcut Mapper > Plugin Commands, you can assign a keyboard shortcut to those scripts. -
Thanks. I will check what the script does and just write a plugin or PR for N++.
PythonScript doesn’t have 64-bit version.
-
@NN—
Why would you want to do this? Seems like you would just be hiding content, which sounds like a bad thing (without knowing more)
-
Notepad++ has huge performance issues when there are many control characters displayed.
-
I also face problem about this.
each character should have single char width.NUL, CR, LF become too long. And are actually ugly and horrifying looking.
I wanted some invisible chars to be displayed but I got scared seeing them displayed in their current dress-up, so I had to stop displaying them.
for every invisible character, please use a single char display method.
like MS Word uses single chars for for paragraph mark and soft hyphen mark.
–
Rawat -
Hello, @nn and @v-s-rawat,
To replace all CO controls and C1 Controls by a specific character, you could also use a simple regex S/R
Refer to these special code-points, clicking on the links below :
http://www.unicode.org/charts/PDF/U0000.pdf
http://www.unicode.org/charts/PDF/U0080.pdf
So :
- For files with an ANSI encoding or a specific encoding ( Encoding > Character Sets > … ), use the following regex S/R :
SEARCH
(?!\t|\r|\n)[\x00-\x1f]REPLACE
a SPACE( or any other single character ! )- For files with an Unicode encoding ( UTF-8, UTF-8 BOM, UCS-2 LE BOM and UCS-2 BE BOM, use, instead the S/R, below :
SEARCH
(?!\t|\r|\n)[\x00-\x1f\x80-\x9f]REPLACE
a SPACE( or any other single character ! )Best Regards,
guy038
P.S. :
Of, course, due to the negative look-ahead
(?!\t|\r|\n), any character replaced, at current position, must be :-
Different from the tabulation character (
\t) -
Different from the two End of Line characters (
\rand\n)
-
Replacing is not a suitable solution since I have a log file which is changing each second.
I just want to see space instead of control character.
Seems like it is possible by calling API SCI_SETREPRESENTATION . -
Hi, @nn,
Oh, I see ! Of course, my proposed static replacement is quite useless, in your case :-(( Sorry and… good luck for implementing the Scintilla API SCI_SETREPRESENTATION !
Cheers,
guy038
-
I mean, if Replacing is the only solution,
hope someone develops a replacement table/ code that would change all control characters display to as used in MS Word/Excel.Then it would be easy for us NON-programmer to use such a table.
Thanks.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login