Sublime Forum

Unsafe close of empty file without confirmation dialog

#1

Currently, the user can close an empty file and ST does not display a confirmation dialog, because the file is empty.

I think this logic is unsafe. If for example I have a temp file and I put important code inside, then for some reason I cut the code from it and paste it into another, non-temp file, then the temp file becomes empty.
If I then forget about it and close it, because I think it’s just an empty file, then I loose all the history of code editing in that file. An ST does not warn me, that that file, though empty, contained someting. That something could be easily restored by Undo.

I suggest to change the actual logic to: Close file without confirmation, only if the file was always empty, not only in the current state.

0 Likes

#2

do you mean an empty tab that has never had a file associated with it?
ST always warns you if a file has been modified, whether it is currently empty or not…

0 Likes

#3

The behavior comes only with temp files (that ware never saved).

0 Likes

#4

By default Sublime Text will warn for any temporary file that’s not empty.

0 Likes

#5

Correct and please read what I wrote in my OP regarding the “Cut” and “Paste” action which leads to an empty temp file.

0 Likes

#6

That sounds like a bug, the indicator for the file being unsaved should match the prompting behaviour. I’ve submitted an issue for that: https://github.com/sublimehq/sublime_text/issues/3661

0 Likes