4

I would like to be able to see all whitespace and control character explicitly in my text editor. Example Hi world! This is a new line! (pretend the new line is actually on a new line) as something like Hi\sworld!\nThis\sis\sa\snew\sline!. Or another example: Some people like spaces while others... like tabs (pretend there is a tab after the three periods) would render as \s\sSome\speople\slike\sspaces\swhile\sothers...\tlike\tabs How can I go about doing this? Also is there a way I can explicitly enter control characters, perhaps using their Unicode value?

I'm sure some of you will want to know why I care to do this. Hacker types would find inherent appeal but, beyond the joy of knowing, an esoteric programing language like Whitespace would be much easier to write for in VS Code if this kind of explicit control were allowed.

So. Can it be done? Are the worlds great text editors powerful and flexible enough to allow for this kind of functionality?

5
  • Not sure if you just didn't check the "View" menu or you really want to display spaces as regexp escape sequences :-? Commented Jul 30, 2018 at 17:08
  • Have you tried the "toggle render whitespace" feature in VS Code? It just displays any and all whitespace characters as dots. I have my tab set to indent two spaces so pressing that will render as two white spaces. Pressing space will display as a single dot. This is not what I am looking for. I don't care if it uses regex notation or emoticons. I just want to be able to see all distinct whitespace character as distinct. And there are many more than just space and tabs. Take a look at the wikipedia article if you haven't already: en.wikipedia.org/wiki/Whitespace_character Commented Jul 30, 2018 at 19:17
  • Yes, I use it everyday and this is what I see (scaled up for visibility). If you see two dots it's because you have two spaces; you probably have "editor.insertSpaces": true in your settings (Insert spaces when pressing Tab). Do you want to get tabs when you hit the tab key or do you want to see spaces reported as tabs when they've been created by hitting tab? Commented Jul 30, 2018 at 19:30
  • BTW, did you mean this Whitespace article? Commented Jul 30, 2018 at 19:35
  • Alright, I've just seen your comment below the first answer. Judging from it, what you really want is to display the Unicode code point or some similar code that allows to identify the specific character. That's certainly not builtin. I suggest you have a look at the extension marketplace. Commented Jul 30, 2018 at 19:44

1 Answer 1

2

In CudaText (free, cross platform) I can config this. I have tweaked few options (in user.json) with names unprinted_*, here is user.json for new app install:

{
    "unprinted_show": true,
    "unprinted_content": "sed",
    "unprinted_tab_len": 0,
    "unprinted_space_dot_scale": 40,
    "unprinted_tab_ptr_scale": 40,
}

This makes space-chars - big dots (40%) and tab-chars - big arrows (40% pointer size). Here's screenshot

CudaText

I tested CudaText with all white space chars from Wikipedia list https://en.wikipedia.org/wiki/Whitespace_character#Unicode . Most are shown by one way or another, high unicode chars (0x2000+) not shown:

  • line ends 0x0A or 0x0D: shown as marker "un" or "mac" or "win" at line ends
  • tab char 0x09: shown as arrow with pale color
  • space char 0x20: shown as dot with pale color
  • char 0x0B, 0x0C: shown as "x0B", "x0C" with pale color
  • char 0x85: shown as font glyph
  • char 0xA0: shown as pale dot, like space
  • char 0x1680: shown as font glyph
  • chars 0x2000...0x200A: shown in hex form like "x200A"
2
  • 1
    That's a nice find. I will look for a similar set of key-value pairs in VS Code. But remember that I also want to display all other whitespace and control characters too. Not just tabs and spaces. en.wikipedia.org/wiki/Whitespace_character Also, I want to be able to explicitly enter each of those values. Carriage return for example (U+000D) or thin space (U+2009). Commented Jul 30, 2018 at 19:22
  • You can enter any Unicode char code into CudaText - install plugin CudaExt, it has command "Insert Unicode char" with dialog to enter hex code.
    – Prog1020
    Commented May 26, 2019 at 22:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.