Sublime Forum

BUG: deleted files rise from the dead

#1

I guess it’s nearly Halloween, since zombie files are rising to eat our brains!

Steps to reproduce:

  • create a file from terminal (“echo foo > foo.txt”)
  • open file in ST2 (double click foo.txt in sidebar)
  • delete file from terminal (“rm foo.txt”)
  • note that the file disappears (zoop!) from the sidebar in ST2
  • switch back to ST2
  • note that the foo.txt tab is still open and is marked as dirty
  • switch back to terminal
  • note that the file has been recreated in the file system

Part of this is probably cause I have “save on focus lost” set, but when ST2 notices that a file has been deleted it should close its tab, not just remove it from the sidebar.

0 Likes

#2

I suspect that would trip up many users.

1 Like

#3

[quote=“jps”]

I suspect that would trip up many users.[/quote]

This is just an additional perspective.
Every editor I’ve used (IDEA, Eclipse, Notepad 2, even Dreamweaver & Homesite) maintained the file open when that file has been deleted outside of the editor. The reasons for this I can only guess because thinking about it a bit I don’t see why an editor shouldn’t close a file on it’s own if it’s been deleted. Perhaps it was a technical limitation at the time of inception and now merely customary.

0 Likes

#4

IMO no editor should create a file on disc, close a tab, or reload a tab without asking first. These action can lead to “lose data”. These actions are very welcome if these are configurable. With the default to false, then “no surprises”.

1 Like

#5

When I delete a file (“rm foo.txt”) or move it (“mv foo.txt bar.txt”) I want it to stay deleted. My text editor must not recreate it in its old location. It also must not keep open a buffer to it in its old location, cause then when I edit it, my changes are going into the wrong file.

This is not a minor issue. It has already cost me time and heartache.

IMO no editor should create a file on disc

Yeah, that’s what ST is doing now. It’s creating foo.txt after I deleted it.

close a tab

Um… what?

or reload a tab

Sure it should. TextMate does that, for instance, and I don’t find that behavior confusing at all. If you want a warning for this, fine, but I also want the option to turn that warning off.

I think you may be lamenting the lack of version control, a la IntelliJ/RubyMine, but that’s a separate feature request.

0 Likes

#6

[quote=“forehead”]

IMO no editor should create a file on disc

Yeah, that’s what ST is doing now. It’s creating foo.txt after I deleted it.[/quote]

No, it doesn’t. It’ll only recreate the file if you press save.

1 Like

#7

Or if I have “save on focus lost” enabled. Which I do. With that setting, merely switching to ST2 and then switching away (re)creates a file.

0 Likes

#8

I can see how that would be annoying.

0 Likes

#9

A list of behaviors I really wish to have just an option to disable:

  • I have a “clean” opened file called “some.txt”, someone else in the network open the same file made a change and save. The file is reloaded without alerting me. When I have a dirty file and someone else change the file I’m alerted that’s great!

Ok, I was unable to reproduce more unwanted behaviors.

I can vaguely ( or wrong ) remember that for some reason the editor “close a tab” by it-self without asking, probably by deleting a file or something like that. With the latest dev build I can’t repro this. This happens?

Thank you!

0 Likes