Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Close empty active window when Close command is given - #9607

Merged
nathansobo merged 2 commits into
atom:masterfrom
DouweM:close-empty-window
Nov 20, 2015
Merged

nathansobo merged 2 commits into
atom:masterfrom
DouweM:close-empty-window

Conversation

@DouweM

@DouweM DouweM commented Nov 15, 2015

Copy link
Copy Markdown
Contributor

On OS X, Command-W is expected to close the current window, unless the current window has tabs (Safari, Chrome, Finder), in which case it will close the current tab, until only one is left, in which case it closes the entire window (and thus also the tab).

Currently in Atom, Command-W will close every pane item in the current pane, then the current pane, and so on until every pane is empty, which makes sense since pane items and panes ~ tabs. However, when only the empty root pane is left, which the user experiences as there being no panes left at all, hitting Command-W will not close the window, but will instead have no effect at all. To actually close the window, one needs to either manually hit the red close button in the upper left corner or the window, choose "Close Window" in the File menu or use the Cmd-Shift-W shortcut, all of which break the OS X UX contract.

With this PR, Command-W will behave exactly as it does right now, with one exception: when only the root pane is left, Command-W closes the entire window.

Hitting Command-W with only one pane item ~ tab open will NOT close the window, which is inconsistent with tabbed web browsing but makes more sense for a text editor.

@mnquintana

Copy link
Copy Markdown
Contributor

Would you mind adding specs for this? Thanks!

@DouweM

DouweM commented Nov 16, 2015

Copy link
Copy Markdown
Contributor Author

@DouweM
DouweM force-pushed the close-empty-window branch from dba566b to f935657 Compare November 16, 2015 16:54
@benogle

benogle commented Nov 16, 2015

Copy link
Copy Markdown
Contributor

Refs #863

@benogle benogle added the atom label Nov 16, 2015
@nathansobo

Copy link
Copy Markdown
Contributor

Great job @DouweM! ⚡ We'll see if everyone yells at us for changing it to work this way now. 😬

@nathansobo

Copy link
Copy Markdown
Contributor

Code looks good, restarting the failed Travis build.

@benogle

benogle commented Nov 17, 2015

Copy link
Copy Markdown
Contributor

IMO, there should be an option to preserve the current behavior

@benogle

benogle commented Nov 17, 2015

Copy link
Copy Markdown
Contributor

@DouweM Can you add a setting for this? Something like closeEmptyWindowOnCoreClose? @nathansobo feel free to come up with a better name.

@DouweM

DouweM commented Nov 17, 2015

Copy link
Copy Markdown
Contributor Author

@benogle May I ask why? The old behavior has never made sense to me or any other Mac/Linux Atom user I know (I don't know any Windows Atom users). You'll always have people complain about changes in behavior, but I think this is a change for the better and I'm seriously wary about adding configuration options just because people don't like change.

@benogle

benogle commented Nov 17, 2015

Copy link
Copy Markdown
Contributor

For behavior changes like this, we need to give people who rely on the current behavior an out. Similar to the recent changes in fuzzy-finder matching algorithm, if it's clear that almost no one wants the old behavior, we can pull the option in the future.

I think this is a change for the better

I dont necessarily think this is a change for the better. It's just different. I for one really love the current behavior, commands do explicitly one thing: close an item or close a window and do not change based on state. I can mash cmd-w 100 times, and know that I wont accidentally close the window. We honestly have had little to no complaining about the current behavior in the last year or so. I'm inclined to think that many people are now used to it.

@nathansobo

Copy link
Copy Markdown
Contributor

Agreed on adding the option. There's no reason to have a bike shed debate on something that's so easy to customize. It originally worked this way and we changed it based on internal feedback from GitHubbers, so I think there's a good argument that it's going to be controversial. Let's avoid the controversy and let people design their own experience.

@DouweM

DouweM commented Nov 18, 2015

Copy link
Copy Markdown
Contributor Author

@nathansobo Fair enough, I will add an option!

@nathansobo nathansobo self-assigned this Nov 18, 2015
@DouweM

DouweM commented Nov 20, 2015

Copy link
Copy Markdown
Contributor Author

@nathansobo Option was added!

screen shot 2015-11-20 at 16 41 31

@nathansobo

Copy link
Copy Markdown
Contributor

Kicking off another Travis build.

@nathansobo

Copy link
Copy Markdown
Contributor

Our Travis build is timing out. Think it may have to do with Blink throttling our timers and animation frames on CI. I'm running a build locally.

@nathansobo

Copy link
Copy Markdown
Contributor

Okay, I figured it out. @DouweM locally I'm seeing the spec you added actually closing the test window, which prevents us from informing the browser process that the tests completed. Could you move the spyOn(atom, 'close') into your before each and see if that gets us a 🍏 Travis build?

@nathansobo

Copy link
Copy Markdown
Contributor

Actually, nevermind, I'll just move it and merge.

@nathansobo
nathansobo merged commit a7809d6 into atom:master Nov 20, 2015
nathansobo pushed a commit that referenced this pull request Nov 20, 2015
@nathansobo

Copy link
Copy Markdown
Contributor

🚇 Thanks for your help @DouweM. 🚇

@DouweM

DouweM commented Nov 20, 2015

Copy link
Copy Markdown
Contributor Author

@nathansobo ❤️

Comment thread src/config-schema.coffee

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this deletion intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was, te default title is the key (followSymlinks) capitalized, which would be Follow Symlinks. The downcase s was inconsistent with the other titles.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants