closeOnExit: graceful doesn't work right after moving a pane to a new tab #14962

Closed
opened 2026-01-31 04:24:25 +00:00 by claunia · 7 comments
Owner

Originally created by @zadjii-msft on GitHub (Aug 25, 2021).

likely regressed in #10780

repro steps:

  • set "closeOnExit": "graceful" (I bet always would work too, but haven't checked)
  • split a pane.
  • In the first pane, run a command. Or just type input. Do anything really, or heck don't.
  • open the command palette and run mp -t 2, to move this pane to a new tab.
  • type exit

expected:
pane exits, and with it, the tab

actual:
image

This is a bug that's only present in 1.11+, but since movePane only exists in 1.11+, it's not technically a regression. If we can't get it fixed for 1.11, we can probably just service this. I don't think this is worth blocking over.

Originally created by @zadjii-msft on GitHub (Aug 25, 2021). likely regressed in #10780 **repro steps:** * set `"closeOnExit": "graceful"` (I bet `always` would work too, but haven't checked) * split a pane. * In the first pane, run a command. Or just type input. Do anything really, or heck don't. * open the command palette and run `mp -t 2`, to move this pane to a new tab. * type `exit` **expected:** pane exits, and with it, the tab **actual:** ![image](https://user-images.githubusercontent.com/18356694/130838930-7c2c8550-b775-4837-83a6-9bf27d5af483.png) This is a bug that's only present in 1.11+, but since `movePane` only exists in 1.11+, it's not technically a regression. If we can't get it fixed for 1.11, we can probably just service this. I don't think this is worth blocking over.
Author
Owner

@DHowett commented on GitHub (Aug 25, 2021):

Huh. What other event handlers aren't getting hooked up? Could it be that Bell and the two focus trackers are also lost? Are we never calling Initialize?

@DHowett commented on GitHub (Aug 25, 2021): _Huh_. What other event handlers aren't getting hooked up? Could it be that Bell and the two focus trackers are also lost? Are we never calling Initialize?
Author
Owner

@DHowett commented on GitHub (Aug 25, 2021):

No, we're calling _AttachEventHandlersToPane and all in AttachPane; perhaps we are not doing it in the "new tab with pane" case?

@DHowett commented on GitHub (Aug 25, 2021): No, we're calling `_AttachEventHandlersToPane` and all in `AttachPane`; perhaps we are not doing it in the "new tab with pane" case?
Author
Owner

@DHowett commented on GitHub (Aug 25, 2021):

Yes, it looks like a pane converted into a new tab can't bell!

@DHowett commented on GitHub (Aug 25, 2021): Yes, it looks like a pane converted into a _new tab_ can't bell!
Author
Owner

@Rosefield commented on GitHub (Aug 25, 2021):

Oh, oops, I'll take a look at this.

@Rosefield commented on GitHub (Aug 25, 2021): Oh, oops, I'll take a look at this.
Author
Owner

@Rosefield commented on GitHub (Aug 25, 2021):

So, sanity checking,

  1. TabManagement calls InitializeTab https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/TabManagement.cpp#L228
  2. Which calls tab->Initialize https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/TabManagement.cpp#L103
  3. Which appears to call AttachEventHandlersToPane https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/TerminalTab.cpp#L210 (and is the same code path as creating a normal tab from a control)

Is this a problem with all moved panes, or just ones moved to new tabs? Admittedly one of the reasons I adopted wt in the first place was so I could turn the bell off, so I never would have noticed it missing. :)

@Rosefield commented on GitHub (Aug 25, 2021): So, sanity checking, 1. TabManagement calls InitializeTab https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/TabManagement.cpp#L228 2. Which calls tab->Initialize https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/TabManagement.cpp#L103 3. Which appears to call `AttachEventHandlersToPane` https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/TerminalTab.cpp#L210 (and is the same code path as creating a normal tab from a control) Is this a problem with all moved panes, or just ones moved to new tabs? Admittedly one of the reasons I adopted wt in the first place was so I could turn the bell off, so I never would have noticed it missing. :)
Author
Owner

@PankajBhojwani commented on GitHub (Aug 25, 2021):

Is this a problem with all moved panes, or just ones moved to new tabs?

Just ones moved to new tabs I think! Did a quick trace and it seems TerminalPage::_MovePane calls _CreateNewTabFromPane, which does not attach any event handlers to the pane Ignore that, it does call Initialize hm

@PankajBhojwani commented on GitHub (Aug 25, 2021): > Is this a problem with all moved panes, or just ones moved to new tabs? <del>Just ones moved to new tabs I think! Did a quick trace and it seems `TerminalPage::_MovePane` calls `_CreateNewTabFromPane`, which does not attach any event handlers to the pane </del> Ignore that, it does call `Initialize` hm
Author
Owner

@ghost commented on GitHub (Aug 31, 2021):

:tada:This issue was addressed in #11039, which has now been successfully released as Windows Terminal Preview v1.11.2421.0.🎉

Handy links:

@ghost commented on GitHub (Aug 31, 2021): :tada:This issue was addressed in #11039, which has now been successfully released as `Windows Terminal Preview v1.11.2421.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.11.2421.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14962