Atom deleted all my work


Somehow atom deleted the project I had open, including the .git directory, so I lost all my work that had not yet been pushed to the remote server.

I’m not sure what I pressed, I was just typing and tried to delete some text I’d miss-typed, and suddenly all my work was gone.

The file sidebar was hidden when it happened, so it didn’t have keyboard focus. There was a confirmation dialog but I had already pressed return before the dialog even opened, so it immediately confirmed and closed before I even had a chance to read the text.

Judging by this screenshot: the normal/default behaviour of the delete confirmation is to move to trash, however “delete” has keyboard focus, so if you hit spacebar after whatever key binding brings up the dialog it will erase the directory without any way to recover.


It really sucks to lose that much data. That’s a mystery to me how that would have happened as well. I went ahead and filed a bug on Tree View to not allow for the deleting of the root directory period. I suspect that it is pretty rare when people honestly want to delete the root directory from inside the editor anyway.


The problem is that if you press cmd-delete in the text editor, which is “delete to beginning of line”, and then press space bar after that (possibly with other key presses in between), whatever file is selected in the tree view might be deleted.

All you have to do is bump the \ key while reaching for the delete key. The sequence of keys I pressed were:

cmd-\ (show/move keyboard focus to tree view)
delete (delete selected file or directory, with a confirmation dialog)
probably some other keys (which would have been ignored)
space bar (activate whichever button has keyboard focus by default in the dialog. in this case “delete”)


In my opinion (by default) there should not be the option to remove a file without moving it to the trash anyway.

In itunes for example if I remove a song I get asked if it should be just removed from the library(the file itself will stay in place) or if I want to move the file to the trash.

Now if I remove a file in atom it is a bit confusing to have two choices as well but with two different meaning (trash vs final deletion).

Without much thinking I could click the button that says no trash (assuming the file keeps in place an just disappears from the treeview).


This issue was resolved in this pull request:

Now “Cancel” is activated when SPACE is pressed and “Move to Trash” is activated when ENTER is pressed.

closed #6