Sublime Forum

Unexpected Behaviour - Can't Find Explanation

#1

I was editing a .php file when I noticed that the paragraphs that I was editing had a new background colour. I was using the colour scheme “Sixteen” which for normal

paragraphs has grey text on a white background. I had created several new, smaller, paragraphs from an existing one and the new paragraphs had a pale green background, which changed shades as I made edits. I then noticed that the original paragraph had been preserved and had a pale red background. When I tried to delete it I could not, and I couldn’t edit it either.

I saved the page an reopened it, and the normal editing behaviour had returned, with no colour shaded backgrounds. I tried to find out what setting I had inadvertently changed which caused the previous behaviour but could not. I am just curious to know more about this feature of ST3.

0 Likes

#2

What you were seeing there was a diff hunk that’s part of the Incremental Diff functionality.

Changes made to files are tracked and altered lines are marked in the gutter, but you can also peek to see what has been added (the text you saw with the green background) and text that has been deleted (the text you saw with a red background).

You can’t edit the deleted text because it’s not technically there any longer (though you can select and copy text out if you want to bring it back).

The feature is described in the documentation at the link above. I also have a video that demonstrates the inline diff functionality as well:

1 Like

#3

Hi,Great odatNurd, thank you for your help with this article. I have a question,is it possible for this read-only method to be added to File Menu -> Open File? Put the open file directly into read-only mode?

0 Likes

Making Sublime Text 3 Read Only
#4

Thank you for your answer to my question, and also for the excellent video tutorial. I have been using ST3 for some time now but I have only scratched the surface of its capabilities. This incident has made me realise that I need to learn more and I am looking forward to watching more of your tutorials.

ST3 contains powerful magic.

0 Likes