Sublime Forum

Disable saving session of a file after closing sublime text 4

#1

I am using sublime text 4 ( recently released Version 4 ). BUT I am having a problem in permanently saving the file after close.

This problem was not in the sublime text 3.

What is the Problem ?

When i make changes in the file and save it and close sublime text then Reopen again and press Ctrl + Z then it it undoing the changes that i have made, BUT i want it NOT to undo the changes after close the file or close the sublime text.

In sublime text 3, Whenever i make changes then close the file then it never undo the changes ( which is good ) BUT this is the problem in the sublime text 4

I have also tried searching many times BUT i didn’t find any solution.

I know This is because in Sublime Text 4 (specifically from Build 4075 onwards), the undo history is stored in the session file (either the global session file if the current window is not associated with a project or the workspace file if it is). Sublime Text 3 did not have this ability.

Since the undo stack is stored in session, whenever i do some kind of edits on a file and exit the app, the undo continues to work for that file even after i open the app.

Thank You in Advance

0 Likes

#2

Why do you want to disable this feature? If you accidentally undo something it’s trivial to redo it, and the undo history has only a small impact on memory/disk usage.

0 Likes

#3

@bschaaf I want sublime text to save permanently after close, Because sometimes when i make some changes and close it then again make changes second time ( which syntax gone wrong ) then i could’ve successfully undo the last changes in previous changes BUT with this new update, when something goes wrong after second changes and if i try to undo it then fisrt changes also undo all. That’s why i deleted sublime text.

0 Likes

#4

Sorry I don’t follow. The saved undo history is purely in addition to any extra changes you make, it shouldn’t override anything or interfere in any way other than having extra history you didn’t have before.

0 Likes

#5

Instead of using Undo All, try using File -> Revert File (down near the bottom). It will revert all your changes back to the last saved state, but no further.

0 Likes

#6

I would also like Sublime Text 4 to behave as Sublime Text 3 did in regards to this issue. When I close Sublime and reopen it, I don’t want to have Ctrl + Z go back further than the save state at the point I closed Sublime. I want it disabled because I will often work on a file during debugging, and I will make changes that I know I want to remove, and holding down Ctrl + Z brings me back to where I want to be. I don’t want to have to pay attention to where I was at, and take the chance of accidentally removing code changes that I do want to keep. No other program works like this that I’m aware of, and it feels unnatural to be able to Ctrl + Z past the state of the file before it was reopened. Besides, why ask why? I believe I’ve paid for now 3 versions of Sublime, and as a paying customer I’m just giving you feedback. This new behavior is not welcome.

1 Like

#7

The suggestion to use File -> Revert File doesn’t actually bring the state of the file back to where it was when opened. It only goes back to the last save, so using that doesn’t do anything to resolve the issue. A File -> Revert to Open would be handy.

0 Likes

#8

I posted a possible solution…

1 Like

#9

Good to go.

0 Likes