Sublime Forum

Help with sort lines problem


Hi to everyone.
I am new to subl and accidentally press F9. When the text changed I totally panicked and close the program.
Later discover of the sort lines function. Tried to undo, but can’t. Now I have my master file ordered in a totally ordered-and-useful format.
What can I do, friends?



correction: unuseful format.



DId you save the file? If not, just revert. If you did … you better have some backups or VCS history, because once you close ST all edit history is lost.



Thanks for your time Fichte. Unluckily (and trying to fix up the problem) later I saved with different encoding. Lesson learned for the future. Thanks!



I also encountered this problem. Have you finally solved it? My text is all confused. How to restore it



Sublime Text 4 restores your undo-stack, so unless you save the file and close it you should be able to simply undo.



After pressing F9, I tried to undo, but the file didn’t respond. Because I was a novice, I tried to save the file and restart sublime, but the file couldn’t be recovered at all. How should I set text out of sorting



As a general rule of thumb, if you do something that breaks your file, it’s not a good idea to save it to disk, and it’s definitely not a good idea to quit the program that did it.

You might have needed to undo more times, or use File > Revert File to reload from disk, discarding any changes. As noted above, if you’re using ST4 then quitting and restarting will restore undo, so long as you didn’t close the file, so you could still try that.

The advice from above still stands; if you save content of a file and then close it, unless you have an external backup of it or it’s in source control, the only way to restore the file back to what it was is to edit it manually.