Sublime Forum

Edit/View Raw Line Endings (is this wanted?)

#1

So I have written a plugin that can allow you to view a file’s raw line endings. You can also change the new line of whatever line the cursor is on, or lines that are selected. Enter is newline and Shift+Enter is Carriage return and new newline. (This would be for ST3 only).

Is anyone actually interested in this?

This is what it looks like:

0 Likes

#2

I would be interested in this. I’ve ran into issues with line endings when copying/pasting code that I write in sublime and paste into a shell.

0 Likes

#3

I’m also interested but I just want to be able to view the line endings.

0 Likes

#4

Check out the plugin at ST3: RawLineEdit.

If you know you only want view only capability, I just added a setting called “view_only”, that will popup a output panel with the line ending view.

0 Likes

#5

Thank you!

The only thing that doesn’t work for me is the colorization.
I’ve copied the color definitions from github.com/facelessuser/RawLineEdit into my own theme and it still displays it in black.

Edit: OK. It wasn’t working because I set

"use_raw_line_edit_theme": false

The reason was that I wanted to leave the cource code colorization intact.
Is there a way to have both - the colorization of the line endings and the default colorization of the editor without messing with default tmLanguage files?

0 Likes

#6

[quote=“gekko”]The reason was that I wanted to leave the cource code colorization intact.
Is there a way to have both - the colorization of the line endings and the default colorization of the editor without messing with default tmLanguage files?[/quote]

Sadly, no…well, if you modify your theme to scope new lines and carriage returns, then yes, but that is a lot of work for every language you want to do that with. That is why it has a special theme for new lines, it is really the easiest way for me to provide high visibility for new lines without providing a custom language file for every language in existence.

0 Likes

#7

Thought of using add_regions? It can only change the background color, yeah, but you’re doing that for CR anyway and the drawback for not being able to see the normal syntax highlighting is kinda huge.

Well, thinking more about it, the problem is that it can break these syntaxes because you are inserting characters at (for the parser/compiler) random points which the syntax definition can’t consider, obviously. Hmm.

0 Likes

#8

You are mistaken about what I am doing, I am not using add regions for CR, that is just how the CR character looks in sublime. Take a look at the code, all I do is read the file raw, and sublime shows the glyph for CR. I then add in a glyph for newline even necessary. I may go into specifics when I have more time.

0 Likes

#9

To be honest I didn’t get the code in the few minutes I looked at it so I thought you just inserted “CR” (the literals) and the tmLanguage made it look fancy but looking at it again your tmTheme only defines foreground colors so that’s not the case.
You don’t have to go into detail, I can do that myself by actually reading the code when I want to, but I don’t really have a need for this right now.

Still, I am kind of surprised that ST can actually show a CR, I thought it was escaping/masking these all the way.

0 Likes

#10

ST does strip CRs, it is only when you read the file and populate a view yourself, that the CR stripping gets bypassed, and then you realize that ST can show CRs just fine.

0 Likes