Show no-break space
-
Hello,
is there any way to show no-break spaces (U+00A0)?
-
-
Hi, Pohli,
The NO-BREAK SPACE character ( of Unicode code-point 00A0 ) is just displayed as the usual SPACE character and, unfortunately, cannot be visualized, with a specific glyph, when using the option View > Show Symbol
To see the interest of the the NO-BREAK SPACE :
-
Choose the option View > Show Symbol > Show all characters
-
Choose the option View > Word wrap
-
Type any text, which continues on the next line
-
Now, select the last SPACE character ( very small orange dot ! )
-
Replace it by a NO-BREAK SPACE (
ALT + 0,1,6,0
on the Numeric keypad )
=> Immediately, the last word, of the first line, is moved at beginning of the second one. Logical, as the two words, before and after the NO-BREAK SPACE character, are, from now on, considered as a single orthographic entity !
Of course, for searching any NO-BREAK SPACE, just type
\xa0
, in the Find dialog.But a nice and easy way to visualize all the NO-BREAK SPACE characters, of a text, would be to select one of them and, then, use the menu option Search > Mark All > Using 1st style to Using 5th style. ( I specially like the default colour of the fourth style ! )
Best Regards,
guy038
-
-
@guy038 said:
Of course, for searching any NO-BREAK SPACE, just type
\xa0
, in the Find dialog.But a nice and easy way to visualize all the NO-BREAK SPACE characters, of a text, would be to select one of them and, then, use the menu option Search > Mark All > Using 1st style to Using 5th style. ( I specially like the default colour of the fourth style ! )
That’s a good workaround for me, thanks alot!
Best regards,
Pohli
-
If you have PythonScript plugin installed (assuming UTF-8 or UTF-8-BOM encoding), go to the console and type:
editor.setRepresentation("\xC2\xA0"," NBSP ")
in the >>> line, and hit RUN. To undo,
editor.clearRepresentation("\xC2\xA0")
If anyone knows how to escape characters in the NPP_EXEC command line, the same could be done with it’s
SCI_SENDMSG
. Actually, what will happen if I copy/paste a true NBSP between the first set of quotes?SCI_SENDMSG 2665 " " "NBSP" SCI_SENDMSG 2667 " "
It works! (I won’t guarantee that the forum keeps the blank between the spaces as an NBSP; if not, you can type it like guy038 suggested)
(SCI_SETREPRESENTATION is 2665; SCI_CLEARREPRESENTATION is 2667; see here)
So, you can change the representation with either NPP Exec or PythonScript plugin.
-
For convenience this is a NppExec script to toggle the alternative representation method of NBSPs suggested by PeterJones:
sci_sendmsg SCI_GETREPRESENTATION " " @"" if "$(MSG_LPARAM)" == "" then sci_sendmsg SCI_SETREPRESENTATION " " "NBSP" else sci_sendmsg SCI_CLEARREPRESENTATION " " endif npp_setfocus sci
Remember to change all the spaces inside the
" "
parts into actual NBSPs, since the forum converts them in normal spaces.
-
For those interested, there’s a PythonScript way of doing this sort of thing, HERE.