Closed Bug 408398 Opened 17 years ago Closed 16 years ago

Command-W Should only close current Tab; closes entire viewer window

Categories

(Thunderbird :: Mail Window Front End, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
Thunderbird 3.0b1

People

(Reporter: mdudziak, Assigned: clarkbw)

References

Details

(Whiteboard: tabs)

Attachments

(1 file, 2 obsolete files)

The problem is that if you have multiple tabs open in a viewer window, pressing command-W (or selecting File->Close) causes the entire mail viewer window to close. As is the case in Firefox, only the active tab should be closed.

To reproduce:
- Right click a message and select 'Open message in New Tab'. Do this for a couple of messages
- Press Command-W, expecting the frontmost tab to close
- Note that the entire message viewer (along with ALL the tabs) closes.
OS: Mac OS X → All
Hardware: Macintosh → All
Flags: blocking-thunderbird3?
In general, I think closing the three-pane window should be harder than it is.
Flags: blocking-thunderbird3? → blocking-thunderbird3+
Whiteboard: tabs
bug 218999 (thundertab) is going to require this change.
going to make this blocking so it's easier to track
Blocks: thundertab
I'm just working in the current code (much of which is really ugly) to make this happen.  However this patch gets the job done and I wanted to make sure to share with everyone.

ctrl-w will close the current tab until there is only one tab left and then it will close the entire window.  This matches the behavior of Firefox on Windows and Linux, not sure about the Mac.

I think making it harder to close down Thunderbird is the wrong approach to the problem.  The reason (as I see it) that we want to prevent Thunderbird from too easily being shutdown is that Thunderbird is so slow to start.  It would be much more beneficial in lots of directions if Thunderbird was actually quick to start and responsive immediately.  

Of course that's a long term battle that we need to win and perhaps the short term fight is preventing people from shutting down by accident.
Could this bug and bug 433322 be related?
I can confirm that the patch works OK.
Any chances for TB ver of Bug 455852 ? (can be default to false ;)
Target Milestone: --- → Thunderbird 3.0b1
reassigning to clarkbw since he's been working on this.
Assignee: nobody → clarkbw
Comment on attachment 345642 [details] [diff] [review]
patch to close the current tabs before closing the window

this looks OK to me, except that the commented out line should just be removed. Asking for review from Phil
Attachment #345642 - Flags: review?(philringnalda)
Comment on attachment 345642 [details] [diff] [review]
patch to close the current tabs before closing the window

Huh, I thought I commented on this on Halloween, a goblin must have eaten my tab. It would have been along the lines of "please fix a few nits and request review from me, so we can land this, just...

>-        CloseMailWindow();
>+/*        CloseMailWindow(); */
>+          CloseMailTabOrWindow();

remove, don't comment out, and don't over-indent the replacement text

>+  var tabmail = document.getElementById('tabmail')

missing semicolon

>+  if ( tabmail.tabInfo.length == 1 ) 

no spaces inside parens, and no trailing space

and it should be ready to go."
Attachment #345642 - Flags: review?(philringnalda) → review-
Attached patch 408398-v2.patch (obsolete) — Splinter Review
Ok, here's the updated patch.

The original CloseMailWindow() function had been removed since the first patch so this is slightly different.  However I put the CloseMailTabOrWindow() in a similar location as before.  And I feel so much more hip now that I used let instead of var, woot!

Let me know if there's anything else needed.
Attachment #345642 - Attachment is obsolete: true
Attachment #347931 - Flags: review?(philringnalda)
Comment on attachment 347931 [details] [diff] [review]
408398-v2.patch

Gah, I stepped right into that one, didn't I? Let me sidestep whether I'll then see another patch from jminta to re-inline it, by just making him review now :)
Attachment #347931 - Flags: review?(philringnalda) → review?(jminta)
Comment on attachment 347931 [details] [diff] [review]
408398-v2.patch

I'm pretty strongly against functions that are only called once. It'd make sense to me to have this logic just inside the switch statement (and extensions can just as easily write goDoCommand("cmd_close") as they can CloseMailTabOrWindow()). Are there any good reasons to keep this as a separate function?
> Are there any good reasons to keep this as a separate function?

None in particular.  Your plan sounds like a good one to me.  I can move the funtionality out of the function and into the switch statement unless someone else who is going to check it in wants to make that change before committing.
Comment on attachment 347931 [details] [diff] [review]
408398-v2.patch

r=jminta with the logic moved to the switch.
Attachment #347931 - Flags: review?(jminta) → review+
Attached patch 408398-v3.patchSplinter Review
Here's an updated version.

Moved the logic of the function into the switch statement.

Carrying over the r=jminta
Attachment #347931 - Attachment is obsolete: true
Attachment #348044 - Flags: review+
i'm not owning this anymore

adding checkin-needed keyword
Assignee: clarkbw → nobody
Keywords: checkin-needed
Assignee: nobody → clarkbw
fix checked in.
Status: NEW → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
-> VERIFIED

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1b2pre) Gecko/20081116 Lightning/1.0pre Shredder/3.0b1pre + Mac
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: