edit: `Close Editor` exits the application if there are no other buffers to close.
- open
edit - select
FilethenClose Editor - select
FileandClose Editoragain
On launch:
After closing the editor:
Close Editor should give a warning only. Exit should terminate the application.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 26 (15 by maintainers)
Commits related to this issue
- Don't exit on Ctrl+W (#326) Closes #175 — committed to psy-repos-rust/edit by lhecker a year ago
You know what, I’ll just remove this behavior now to be in line with VS Code. It doesn’t close on Ctrl+W, so… eh.
I would Ctrl-W without an open document very much to close
edit. Why?So in summary, you chose a shortcut for closing
editthat is different from what at least one other of your own editors uses (so inedit, I cannot use what I know from elsewhere), that is completely ignored by at least two of your own editors (so elsewhere, I cannot use what I re-learn inedit), and that is masked by a third of your own editors (so at times I cannot use anything at all).I noticed this change almost immediately after upgrading (it has wrecked my muscle memory for writing git commit messages on the command line). I totally get the intended behavior if you just flat out launch edit, but perhaps this behavior could be dependent on either a global user preference or based on whether a filename was specified on the command line or not.
Gotcha, interesting (and relevant to our prior discussion about extension paradigm and small vs. large programs).
Yeah, nice. I only wish the prior art wasn’t a GUI application as that subtly influences the overall assumptions about interaction.
👌
This doesn’t matter much yet, but long-term I think it’s useful to have an empty state with no open documents. For instance, a feature where you can open a directory instead of a file. It then presents you with a fuzzy file finder. Example: nginx configuration file consist of a set of files all within
/etc/nginx. It would be useful to be able to open/etc/nginxitself.Yep, same. Hence me going back and forth on this. For now, I’ll imitate VS Code, not because it’s perfect, but rather because it lets me point to it and say, “it does it so we can do it too”. This simplifies discussions. If we ever decide otherwise, change defaults, and people complain, I’m 100% fine to take the heat. I’ve seen with other projects what happens if you give into community dissatisfaction over moving the cheese, and it’s routinely a bad decision. Moving the cheese is sometimes a good thing for long-term happiness. (Don’t give me a Windows as a counterpoint to this. There are obvious counterexamples, I know that. 😄)
This dichotomy will likely come up again and again and I’m undecided on this. The priority is to make this stupidly simple first, useful second, and powerful third. So, if we can have “I can’t believe it’s not a GUI editor!” without impacting the first two priorities, I’d do it. If there are ever soft lines we can’t decide on, we’ll decide them according to gut feeling.
I assume this is an artefact of modeling Edit after VS Code, where:
Not sure how much of this will ever apply to Edit, but at least the untitled situation already exists.
It also hooks Ctrl+W, no? For me that closes the focused terminal.
To debug Edit while working on it in VS Code 😉
Not entirely sure if we should add it just yet. As GitMensch noted, anything we add will be something people come to rely on. This applies to Ctrl+W as much as the “Close All Editors” menu item.
That said, I do think we should add it eventually. It’s just that I would put it exclusively into the command palette. I would accept a PR though that adds support for key chord sequences, so that we can add support for
Ctrl+K, Ctrl+Weventually - the same keybinding that VS Code uses for this.We decided that we’d like to keep the current behavior. It also matches the behavior of most (all?) browsers which also close when you close the last tab. Of course, and editor is not a browser, but there’s small, tangible benefits to the current behavior and we should wait a bit longer to see whether it’s a problem for more people.
I copied the string from VS Code. I didn’t give it too big of a thought, but I did wonder about it as well. We can rename it to “Close File” later. (If we made that change now it would conflict with several other PRs.)
Is there a reason it’s called Close Editor and not Close File to be consistent with the other file operations? I know some apps like web browsers will close the program when doing a Ctrl-W on the last tab or an empty window so there is some precedent for not disabling the menu option when no documents are open.
because sometimes you press too long or double CTRL+W and don’t want your program to be closed - because if you want that you go with CTRL+Q directly (I obviously also care much more about the ASCII fallback for search [before you ask 😉 I don’t plan to work on “edit” myself, currently])