Sublime Forum

Show All Characters

#1

Is there an option to “show all characters” and/or “show end of line characters”? I often need to see unprintable characters.

Thanks,
Scott

0 Likes

#2

drawWhiteSpace doesn’t seem to display end of line and carriage return characters etc… is there a way to get them to appear?

Also, I’d like to view a file as hex, is this possible?

I like the look of Sublime and wanna ditch PSPad :smiley:

0 Likes

#3

It doesn’t display end of line characters, no - my feeling is that it’s pretty clear where the end of line characters are, and drawing them explicitly just gets messy.

There’s no hex editing mode in Sublime Text.

0 Likes

#4

I have set the user option “drawWhiteSpace none”, however, when I make a multi-line selection, I still see a single selected whitespace added to the end of each line for the newline and/or carriage-return character. To me, this looks like a space has been added to the end of every line when selecting.

Often I will do a Ctrl+A to perform a quick visual check for unnecessary white-space at the end of lines, and this extra selected byte makes things a bit more difficult to do that. Normally I would assume that the “drawWhiteSpace none” option would hide selected newlines and carriage returns, but maybe it is tangled up with a different option which I am overlooking? Any help would be appreciated.

Liking Sublime more and more every day :smile: Cheers!

0 Likes

#5

Yeah, that’s a bit of a compromise - if it didn’t do that, it would be impossible to tell if an empty line was selected or not

0 Likes

#6

Understandable. However, there is something to be said for seeing exactly what printable characters have been selected, no? This is the way Notepad and Metapad handle selection, and I’m just whining because that’s the way I’m used to. :wink: I never had trouble knowing which empty lines were selected as long as they were bordered by selection on either side, or the cursor was on the line below.

However, I do realise that because of multi selection in Sublime Text there would be the possibility of confusion. For example, two selections that otherwise look identical could possibly be selecting a different number of empty lines. Not sure how big of a problem this would be in practice, though; I don’t often multi-select but when I do, I am usually well-aware of the extent of what I’ve selected.

Wordpad and Notepad++ also highlight the newlines in selections as in Sublime Text and likewise offer no way to turn off that behaviour. :shrug: So I guess I still suggest it, but not if it’s a major coding change for you. I can live with it :smile:

0 Likes

#7

+1 for me too, particularly regarding displaying end-of-line so that I can visually catch extraneous trailing whitespace. Textmate has Show/Hide Invisibles, which displays a subtle little gray character at the end of each line. I always have that turned on and don’t find it distracting.

0 Likes

#8

Base File.sublime-settings:

// Set to "none" to turn off drawing white space, "selection" to draw only the // white space within the selection, and "all" to draw all white space "draw_white_space": "selection",
ST2 display space and tab chars but not end-of-line chars, and IMHO is the right thing to do.

0 Likes

#9

All those space characters get really cluttered… I think the “less is better” approach is good here. Compare SublimeText2 w/ TextMate’s “Show Invisibles”:

http://echonull.colinta.com/tnfuwy/sublime.png

http://echonull.colinta.com/tnfuwy/textmate.png

(please excuse the horrible colors in TextMate 2, the alpha release is ignoring my beautiful zenburn theme)

For completeness, here is what I think just looks spiffy:

http://echonull.colinta.com/tnfuwy/spiffy.png

0 Likes

#10

[quote=“colinta”]For completeness, here is what I think just looks spiffy:

http://echonull.colinta.com/tnfuwy/spiffy.png[/quote]

If this existed I would use it everywhere. Plus then when you have a selection that selects the newline character it’s really obvious what’s going on.

0 Likes

#11

I can see why you would say that it would make the interface cluttered, but there is a valid use case for showing line ending characters.

The problem is that if you open text files from outside sources it’s not easy to know what line ending scheme is being used. And there are cases when you need to know whether the author is using windows, unix or classic mac style endings. And there are cases when this is important.

While it may clutter the interface, having the option to show line endings would be a preference that could be turned off by default and only turned on by those who wish to see them.

At the moment, I have to open a text file in a different editor when I need to know what line endings are being used, and it’s more common than you may think (at least once a week, sometimes many times a day, depending on what I’m working on).

0 Likes

#12

That’s an entirely different topic than drawing little glyphs at the end of each line

0 Likes

#13

[quote=“jps”]

That’s an entirely different topic than drawing little glyphs at the end of each line[/quote]

Agree, it’s a totally different topic but I like to have the line endings type displayed somewhere in the status bar (along the encoding).

And for the record even if nobody ask me, I really dislike the line ending symbol everywhere, it’s only useless noise.
Just active trim_trailing_white_space_on_save and you never have to think about it.

For the line ending type information currently missing, this is my plugin:

[code]import sublime_plugin
import sublime

def DisplayEncoding(view, encoding="", line_endings=""):
view.set_status(‘encoding’, “%s %s]” % ((encoding if encoding else view.encoding()), (line_endings if line_endings else view.line_endings())))

class StatusBarEncodingListener(sublime_plugin.EventListener):
def on_load(self, view):
DisplayEncoding(view)

def on_post_save(self, view):
    DisplayEncoding(view)[/code]
0 Likes

#14

+1, I would definitely like this a lot. I’m used to having TextMate Invisible Characters turned on and it helps a lot.

I guess my use case is that I don’t want people I work with to commit trailing whitespace (seems to happen all the time).
Would be great to have an option something like "“draw_white_space”: “trailing” that only shows invisible characters at the end of a line.

Of course even better would be if we can easily differentiate between space, tabs, carriage returns instead of just seeing “dots”.

No priority, but would be really cool. Keep on rocking, Sublime 2 is the best!

0 Likes

#15

+1 from me – especially if there were some visual distinction between \r and \n.

0 Likes

#16

+1 but i would implement it in a slightly different way. I need to know clearly if there is a CR vs CR LF. I use text editors to view and manipulate data files quite often, and the distinction is significant. See this topic for screenshots of how it’s done in Scintilla and notepad++ which is more useful.

https://forum.sublimetext.com/t/display-line-endings-line-by-line-like-in-scintilla/6517/3

0 Likes