Sublime Forum

Show returns with invisible characters (in a html file)

#1

Hello,

i would like to display invisible characters in my html codes on SublimeText.
Even the return character

I have added the code
"draw_white_space": "all"
in Preferences>settings>right page

this work to display spaces as little grey points. But i do not see the return at the end of the line.

On example (see image below),
this is what Sublime Text shows at the end oof lines
and this is what I expect (example from Libre Office), can you see the blue caracter at end of each line, like a reversed P ?

0 Likes

#2

Line ending won’t be visualized. They are finalized when saving a file. Internally in plugin API, it’s always \n in the buffer by ST’s design.

The most close thing is

	// Display line endings in the status bar
	"show_line_endings": false,
0 Likes

#3

Hi.
I tried false and true, but nothing seems to change on the display.
Is it supposed to change something ?
What is the “status bar” ? Is this the place where i can read “2 lines, 3 characters
selected” etc ?

Well, i am thinking in another solution to “display” the return / line endings.
You know, in Libre Office Writer, it is possible to choose a space before paragraph (let call it Y).
So between two lines on the same paragraph, you have a X height, and between lines of differents paragraph, you will have X+Y height.

That is helpfull to see where the lines breaks.

An example in picture : 01

So the question is : can ST do the same ?

0 Likes

#4

yes

image

Any thing you can get via ST plugin APIs, as I said, file content always use \n internally, it makes no sense to display them. The current used line ending can be displayed at the status bar as I said previously.

If you MUST display \r, you have to read the file by yourself. But still, it only works when file is initially loaded. I don’t think you can have it work flawlessly by any means.

What if my file has intentional mixed line endings? I don’t know honestly but pretty sure ST normalizes line endings when saving a file.

0 Likes

#5

As i read your help, i understand my context was not enough precise/clear.

I forgot to say that i use ST exclusively for typing html codes.
So my files always are .html (and you can see the colors in the screen capture).

So the status bar do not tell me to choose the kind of line ending i want. Line ending cannot be mixed, there is only the html line ending.
I put at the end a screen of my status bar, like it is displayed.
As the file is .html until i start to write in it, maybe that means that ST already knows what kind of line ending it have to use.

Maybe a small hope that i can display something for identify lines endings when the ST file is . html …

43

0 Likes

#6

Maybe i can also tell WHY i want to display line ending.

I want to display line ending because i need to discriminate, when a line breaking is on my screen, if this line breaking is made by

  • a “line ending invisible character”
  • an automatic line breaking because the end of the display width

See example here : 42

0 Likes

#7

you have to enable it. Show returns with invisible characters (in a html file)

0 Likes

#9

From your desciption, my best suggestion is now any of the followings

  • Disable wrapping.
  • A plugin which insert a phantoms (visual indicator) at every end of lines. But technically, the line number already gives you this information.

I now realize that this is not an issue about \n vs \r\n, or visualizing \r.

0 Likes

#10

I need the wrapping to see all my code quickly.

A visual indicator would be great and it is what I am looking for.
In fact, it is what “show invisible character” is doing : visually indicates things. But, unfortunately, it does not visually indicate line endings. That sounds strange for me, because i suppose there is “something” at the end of the line to tell the code that “it is the end of the line”. So why this cannot appear ?

Well, at the end, maybe i will just use line number to know when lines are ending or not, but i think it is not the more helpfull tool, especially when the lines have strong indentation.

Thank you anyway for tried helping me !

0 Likes

#11

Another suggestion, enable this in preferences, so you know the range of the current line visually.

	// If enabled, will highlight any line with a caret
	"highlight_line": false,
1 Like

#12

That is a good idea.
Thank you.

0 Likes