Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmd+W with no open tabs doesn't close the window #5322

Closed
adamsoutar opened this issue Jul 4, 2022 · 20 comments · Fixed by #10740 or #11989
Closed

Cmd+W with no open tabs doesn't close the window #5322

adamsoutar opened this issue Jul 4, 2022 · 20 comments · Fixed by #10740 or #11989
Labels
enhancement [core label]

Comments

@adamsoutar
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Just a tiny nit (feel free to say if these tiny bugs aren't helpful), but when the window is empty, I would have expected Cmd+W to act like Cmd+Shift+W, but it currently does nothing.

(See: behaviour in Atom, VS Code)

@adamsoutar adamsoutar added enhancement [core label] triage Maintainer needs to classify the issue labels Jul 4, 2022
@JosephTLyons JosephTLyons removed the triage Maintainer needs to classify the issue label Jul 4, 2022
@mikayla-maki mikayla-maki mentioned this issue Dec 4, 2022
48 tasks
@fuzenco
Copy link

fuzenco commented Dec 14, 2023

Yes, it’s one of those little things that would make Zed better for me. I frequently work with just single files at a time. Having that last window automatically close would be awesome.

@fredngo
Copy link

fredngo commented Mar 19, 2024

This is expected MacOS behaviour and sorely needed!

@dangh
Copy link

dangh commented Apr 25, 2024

TBH I think the way VSCode designed this feature is a mistake. There are two separate actions:

  • Close a pane
  • Close a window (which is empty)

and it happens that we want to use the same keybinding for these actions. The proper way to implement it is mapping the same key in different contexts, not introducing an "option".

Also, there is not an application on macOS that I know behaves this way. They never have an "empty" state as it always requires a file/document to work with. But in Zed, we have an empty state and it is useful. Following macOS behavior is just wrong.

My apologies if it sounds harsh. Zed is moving fast and ships lots of useful features but it also introduces breaking changes that make it frustrating to use. Especially with someone who didn't come from VS Code world like me.

@clseibold
Copy link

clseibold commented Apr 25, 2024

I agree with @dangh . On Linux and Windows, VSCode doesn't close the window on Ctrl+W, but Zed now does apparently (assuming Ctrl+W is the Linux/Windows equivalent of Cmd+W). Yuck! I hate that!

I'd like that this change be restricted to macOS only, or reverted :)

@maxdeviant
Copy link
Member

We are reverting this change in #10986.

A new Preview build will be out soon without this behavior.

@mijndert
Copy link

@maxdeviant any chance we can get this back for macOS? Not being able to close the window with cmd+w when no tabs are left is really the opposite of what you would expect from a Mac app.

@fuzenco
Copy link

fuzenco commented Apr 28, 2024

@maxdeviant any chance we can get this back for macOS? Not being able to close the window with cmd+w when no tabs are left is really the opposite of what you would expect from a Mac app.

I agree. I’ve been running Mac for nearly 30 years and no native app leaves a window open. And even Electron apps adhere to that. Give us an option.

@dangh
Copy link

dangh commented Apr 28, 2024

@fuzenco I hope the option would be mapping the key in different contexts like I described above. In fact, that's how Safari does it too. When the window has tab, Cmd+W is bind to Close Tab, but on an empty window it's bind to Close Window.

All the macOS apps I know either work with single documents (so there's no point leaving an empty window) or have an option to restore the closed window (all browsers have that). Zed is not in the first category so if we want to make that the default behavior then restorable must be shipped together.

@clseibold
Copy link

clseibold commented Apr 29, 2024

Many apps don't have the concept of an open project where you would want to keep a window open with no tabs. But for a text editor, people frequently keep a project/folder open with no tabs. That is why I consider this macOS design to be awful UX. In a browser, you can just close the window when you close the tab. Not so for text editors. Context matters in UX-design.

@fuzenco
Copy link

fuzenco commented Apr 29, 2024

Not so for text editors. Context matters in UX-design.

I don’t know about that. One of the longest-running text editors on Mac—over 30 years—the famed BBEdit, allows for closing a project window when there is no tab open.

@clseibold
Copy link

clseibold commented Apr 29, 2024

I don’t know about that. One of the longest-running text editors on Mac—over 30 years—the famed BBEdit, allows for closing a project window when there is no tab open.

Sure, and my opinion is that that is terrible design. Almost every editor I know doesn't do this on Windows/Linux, including VSCode and Sublime Text. There's a reason for that.

The special exceptions being text editors, like Notepad on Windows, that don't open folders/projects, which I think demonstrates my point well: Closing all tabs does not mean you want to close the whole project/folder.

@fuzenco
Copy link

fuzenco commented Apr 29, 2024

I don’t know about that. One of the longest-running text editors on Mac—over 30 years—the famed BBEdit, allows for closing a project window when there is no tab open.

Sure, and my opinion is that that is terrible design. Almost every editor I know doesn't do this on Windows/Linux, including VSCode and Sublime Text. There's a reason for that.

And that’s why we are asking for the option, even if that’s not the default you would wish.

@clseibold
Copy link

clseibold commented Apr 29, 2024

allows for closing a project window when there is no tab open.

Also, you can close a window without this option. You use the specific keybinding that closes the window: Ctrl+Shift+W.

I'm certainly not opposed to people having an option of a keybinding overload, I just don't think it should be on by default on any platform (who knows, I might want to or have to use macOS in the future!)

Anyways, one option is to allow Ctrl+W to close the window only if there is no project/folder opened and there are no tabs open. If there is a project/folder opened, then it shouldn't ever close the window. That'd already be a vast improvement for a small change in design.

The biggest reason why I think Ctrl+W should not close the window when there's a project open is because if I were to press Ctrl+W too many times for the tabs I have open, then I would accidentally close the window when I didn't intend for that.

@fredngo
Copy link

fredngo commented Apr 30, 2024

I was so excited to see this was finally done and then saw it was reverted!

I understand that it perhaps doesn't feel right in Windows or Linux. But on Mac, it is expected behaviour to have Cmd+w close the app when there is no file open. Don't care about whether it is "wrong UX" or not -- unfortunately there is decades of history behind that now.

So, we need an if statement basically! Yes, it's annoying that things don't behave all the same way in Mac, Windows, and Linux but I'm sure this wouldn't be the only if statement to take care of stuff like this in the whole program.

@fredngo
Copy link

fredngo commented May 1, 2024

So... this issue is in the closed state now. But it's not actually closed. Can we re-open please?

@mikayla-maki can help reopen maybe?

@bartekpacia
Copy link

bartekpacia commented May 1, 2024

It still doesn't work for me (macOS Sonoma 14.4.1, Zed 0.133.5)

@maxdeviant maxdeviant reopened this May 1, 2024
@huangqun
Copy link

huangqun commented May 2, 2024

It's not working for me either (macOS Sonoma 14.4.1, Zed 0.133.5).

@maxdeviant
Copy link
Member

It still doesn't work for me (macOS Sonoma 14.4.1, Zed 0.133.5)

We reverted the change, so that’s why it isn’t working.

@thuvasooriya
Copy link

It still doesn't work for me (macOS Sonoma 14.4.1, Zed 0.133.5)

We reverted the change, so that’s why it isn’t working.

whyy whyy whyy
can i override the keybindings?

mikayla-maki added a commit that referenced this issue May 17, 2024
…#11989)

Follow up to: #10986

However, I have set this to have a default behavior of 'auto': matching
the current platform's conventions, rather than a default value of
'off'.

fixes #5322.

Release Notes:

- Changed the behavior of `workspace::CloseActiveItem`: when you're
using macOS and there are no open tabs, it now closes the window
([#5322](#5322)). This can
be controlled with a new setting, `when_closing_with_no_tabs`, to
disable it on macOS, or enable it on other platforms.
@mikayla-maki
Copy link
Contributor

It's on main now, should be hitting stable in two weeks and change :)

osiewicz pushed a commit to RemcoSmitsDev/zed that referenced this issue May 18, 2024
…zed-industries#11989)

Follow up to: zed-industries#10986

However, I have set this to have a default behavior of 'auto': matching
the current platform's conventions, rather than a default value of
'off'.

fixes zed-industries#5322.

Release Notes:

- Changed the behavior of `workspace::CloseActiveItem`: when you're
using macOS and there are no open tabs, it now closes the window
([zed-industries#5322](zed-industries#5322)). This can
be controlled with a new setting, `when_closing_with_no_tabs`, to
disable it on macOS, or enable it on other platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement [core label]
Projects
None yet