-
Notifications
You must be signed in to change notification settings - Fork 121
Provide option to allow keeping open deleted tabs #306
Comments
The problem with automatically deleting a tab even if the buffer is unchanged, is that the buffer becomes the only copy of the work. It's very odd that a destructive action doesn't require confirmation. I've lost work because of this. |
Reposting my comment from another issue:
|
Suppose you have a file opened in Eclipse, Microsoft Word, or just about anything that looks like an editor, and the file on disk is deleted by another system, I think you will find that the in-memory buffer is not automatically flushed. Thus I argue that Atom's behavior is surprising. We can argue about what behavior is best, but I would strongly argue against surprises. |
I often have to swap source control revision, working on a large corporate app with a bunch of active branches. I recently switched from Sublime, where a change of branch would leave files open that were no longer in the file system and when I switched back I could continue editing. Now I find the files in the editor are closed or if unsaved they're re-named in their tab from package.json to package.json-c5c53cf0, so now every time I swap back my branch I have to use save as if I had forgotten to save all changes prior to branch swapping. What a painful and unacceptably messy user experience. Sublime got this right and Atom needs fixing urgently IMO. |
Adding to the above points and scenarios: Some day, probably a busy one when you're moving way too fast and haven't had your ☕ , I agree that Atom's current behavior is surprising, and think that this should be a configurable preference, further arguing that the default should be that buffers remain open. We don't need to argue if it's a toggle preference, and "no surprises" (as @lemire said) does sound like the sensible default to me. |
Let me clarify the issue so that it is clearer to everyone: DescriptionCurrently, Atom removes and deletes a tab whenever the corresponding file on disk is deleted. It is surprising to delete an in-memory buffer (an Atom tab) without giving the user any chance to save their work. This is surprising because no other editor, IDE or word processor works this way. It is always understood that the in-memory copy is distinct conceptually from the persisted copy on disk. This is a new behaviour introduced by the following issue ... It was raised by @adambuczynski because "deleting an unedited file from within Atom which had it's tab open caused you to have to jump through 4 different hoops". That is, Atom made it difficult to delete a file within Atom. However, @adambuczynski agrees that "files being deleted externally are a different use case and should probably be handled differently". Steps to Reproduce
Expected behavior: The tab should remain open, the in-memory content should remain so that the user can save it again, possibly elsewhere Actual behavior: The in-memory content is lost whenever the on-disk content is deleted. |
As @lemire pointed out and as I mentioned in the other issue, my biggest problem at the time was with how annoying it was when you're deleting a file from within Atom. If you do that, you expect the file to go away and any tabs of that file to get closed. If you need to recover the file, you can get it from the trash or from your version control. However, when that issue was addressed, the solution was applied globally, causing any deleted file (regardless of what actioned the delete) to close the tab and clear the buffer in Atom. As people have since then pointed out, this has caused some problems for various use cases:
From my point of view, instead of providing an option, it would probably be better and simpler if Atom would distinguish between "Atom initiated deletes" and any "External deletes". If a user deletes a file via tree view in Atom, behave as it's doing now. There is already a confirmation dialog in place. If an external process deletes a file, revert back to old behaviour, keeping the buffer/tab of the file open. Correct me if I'm wrong, but since the Atom-initiated delete is easy to track (I think it can only be done from tree view, so just one command), it should be fairly simple to implement this? |
@adambuczynski +1. I just moved from sublime to atom. Atom auto closing the file on its gui while switching branch is annoying. Badly in need of this feature, where it retains the tab with the file contents in its memory |
@50Wliu sorry to tag you in this (you are in the atom org and made the last commit so you won) but as @adambuczynski points out above, this issue was caused by unintended side-effects to another issue and should really be marked as a regression (high priority in my opinion), do you know who we need to tag to raise the priority of this issue? |
/cc @iolsen, @mnquintana |
Thanks for raising this, @Anthropic. I agree this is surprising behavior and should be considered a bug. We'll look at this soon. |
@50Wliu you rock! @iolsen that's so great to hear, really looking forward to being able to use Atom as my main IDE again :) |
@iolsen do you know what causes the tabs to re-name files after changing branches with a new extension like index.json**-9309511f**? Is it part of this issue or separate? |
@Anthropic I don't know, but thanks for mentioning it here. We'll look when we get to this issue. |
@iolsen I came back to check in on this and see that it's been assigned and triaged today, but "in progress" since October 28th (atom/text-buffer#178). Really looking forward to this being patched! 🎆 Happy New Years! 🎆 |
And Sublime |
I agree. I'll make that change. |
@iolsen After testing on linux, with Atom 1.13.1(before your changes), here's the behavior I saw (there's no setting for deleted files in settings): Linux
|
@iolsen Seems to be working well on Mac 🎉 Mac
When the tab is preserved, the tab loses the file name and reverts to I also think after install the |
Yeah this is the intended behavior I just goofed on the table. (It's fixed now.) Thanks for your help here! Glad your results are good. Still Looking into the Linux issues. |
Cool, no worries. Glad I could help. |
One more round with the latest fixes, which are now on master @ungb. For each platform:
|
Ok so in general it is working well on OS X, but the items I've marked with a red cross are buggy. In particular the last item, I can reproduce this consistently. When I have a new unsaved file, and close the window, then re-open and save the file, any subsequent editing of this file does not mark it as modified, allowing me to close the tab without warning. Hence the same behaviour when removing outside of Atom. The same goes for creating a new empty file, saving it, deleting it outside Atom. The file is not marked as modified, and subsequent editing of the buffer also doesn't mark it as modified. Tested on Atom 1.15.0-dev-81e8ccc |
Good find @adamreisnz! For the last item and the scenario (following scenarios are default settings) Not working The two scenarios I can repro have to do with |
I've tested on the different os. Based on the test cases everything passed the different OS's. I can repro the issue that @adamreisnz reported. Another issue I saw was:
Actual: Atom opens new file with the current folder. The changes on the file that was modify in step 2 are gone. When you close Atom and reopen with Expected: old tabs and unsaved changes should exist(if there are any) and new file should open in new tab Test Results: MAC
Windows
Linux(Centos)
|
I see this, too. I'll investigate.
Please do. Sounds orthogonal to this one. |
I'm able to reproduce the issue @adamreisnz reported in the current stable, so I've logged atom/text-buffer#198 and am closing this. This is set to ship in 1.15. |
Thank you so very much @iolsen for all your work on this and @ungb @adamreisnz for helping to test it, thank you, you have made my day :) |
@iolsen when you say 1.15 does that include 1.15.0-beta1? When I switched branch in hg (mercurial) the file name still changed from Does that mean it is unrelated and still needs fixing or is there a flag I have missed in relation to the change? |
Hey @Anthropic, Where do you see the file name changed? in the tab or tree-view? I don't see this behavior. I installed hg(mercurial) and ran hg init. I open the project on atom-beta, deleted the file on one branch and changed branches, the file is removed when I check out the branch that has it deleted, but the tab stays(as expected). |
In the tab only. Well in the tree view if I hit save obviously, but if I don't then only the tab. |
Oh the file has to be in both revisions but changed |
@iolsen @ungb |
Hey @Anthropic, Thanks so much for all your feedback and reports of issues you are seeing. We definitely want to take a look at the issues you are seeing and make sure to fix them. Since this issue is closed, can you create another issue with repro steps the issues you are seeing above? It would help us prioritize and get the issue fixed faster. |
I have some testing code that regenerates a directory structure each run. I would like to keep a tab open to observe the changes to the file when it is regenerated.
This make its difficult to check changes from generated files, such as transpilation output, etc.
After #160, the tab is removed, even though it is regenerated again within seconds, before the window gets focus again.
Sublime Text keeps them open, and only updates on focus.
I think there should be an option to allow only refreshing/deleting tabs on window focus.
The text was updated successfully, but these errors were encountered: