Remaining tabs are not resized when closing tabs #13436

Open
opened 2026-01-31 03:42:39 +00:00 by claunia · 17 comments
Owner

Originally created by @DavidZidar on GitHub (Apr 14, 2021).

Windows Terminal version (or Windows build number)

1.8.1032.0

Other Software

No response

Steps to reproduce

Open a bunch of tabs, close all but a few with the keyboard.

Expected Behavior

I expect tabs to be restored to their original size when the space allows for it.

Actual Behavior

Tabs remain compacted indefinitely. The only way to get the tabs back to their expected size seems to be to grab the mouse and hover over the tab bar and then move the mouse off the tab bar again.

Originally created by @DavidZidar on GitHub (Apr 14, 2021). ### Windows Terminal version (or Windows build number) 1.8.1032.0 ### Other Software _No response_ ### Steps to reproduce Open a bunch of tabs, close all but a few with the keyboard. ### Expected Behavior I expect tabs to be restored to their original size when the space allows for it. ### Actual Behavior Tabs remain compacted indefinitely. The only way to get the tabs back to their expected size seems to be to grab the mouse and hover over the tab bar and then move the mouse off the tab bar again.
Author
Owner

@DavidZidar commented on GitHub (Apr 14, 2021):

I understand the tabs remain fixed in size until the mouse leaves the tab bar like what was mentioned in #8030, but this makes no sense when closing tabs with the keyboard or even when just exiting shells while the mouse is nowhere near the tab bar.

@DavidZidar commented on GitHub (Apr 14, 2021): I understand the tabs remain fixed in size until the mouse leaves the tab bar like what was mentioned in #8030, but this makes no sense when closing tabs with the keyboard or even when just exiting shells while the mouse is nowhere near the tab bar.
Author
Owner

@DHowett commented on GitHub (Apr 14, 2021):

We suspect that this is an issue with MUX 2.5 :|

@DHowett commented on GitHub (Apr 14, 2021): We suspect that this is an issue with MUX 2.5 :|
Author
Owner

@DavidZidar commented on GitHub (Apr 14, 2021):

Should I report this issue at microsoft/microsoft-ui-xaml or hold off until you are sure?

@DavidZidar commented on GitHub (Apr 14, 2021): Should I report this issue at microsoft/microsoft-ui-xaml or hold off until you are sure?
Author
Owner

@DHowett commented on GitHub (Apr 14, 2021):

Oh, sorry -- I'll move this issue report over there. I wasn't very clear on that. :)

@DHowett commented on GitHub (Apr 14, 2021): Oh, sorry -- I'll move this issue report over there. I wasn't very clear on that. :)
Author
Owner

@DavidZidar commented on GitHub (Apr 14, 2021):

Thank you! And thanks for Windows Terminal, it's awesome! :)

@DavidZidar commented on GitHub (Apr 14, 2021): Thank you! And thanks for Windows Terminal, it's awesome! :)
Author
Owner

@zadjii-msft commented on GitHub (May 6, 2021):

I've moved this upstream to /dup https://github.com/microsoft/microsoft-ui-xaml/issues/4971. Thanks!

@zadjii-msft commented on GitHub (May 6, 2021): I've moved this upstream to /dup https://github.com/microsoft/microsoft-ui-xaml/issues/4971. Thanks!
Author
Owner

@ghost commented on GitHub (May 6, 2021):

Hi! We've identified this issue as a duplicate of one that exists on somebody else's Issue Tracker. Please make sure you subscribe to the referenced external issue for future updates. Thanks for your report!

@ghost commented on GitHub (May 6, 2021): Hi! We've identified this issue as a duplicate of one that exists on somebody else's Issue Tracker. Please make sure you subscribe to the referenced external issue for future updates. Thanks for your report!
Author
Owner

@DavidZidar commented on GitHub (Oct 23, 2021):

@zadjii-msft Hi again, this was finally supposed to get fixed with #10508 and #11240 in v1.12.2922.0 but I'm trying it in v1.12.2931.0 and it is not fixed. Tabs still remain compacted when closing using only the keyboard and I still have to mouse over the tab bar to make them snap back to the expected size.

@DavidZidar commented on GitHub (Oct 23, 2021): @zadjii-msft Hi again, this was finally supposed to get fixed with #10508 and #11240 in v1.12.2922.0 but I'm trying it in v1.12.2931.0 and it is not fixed. Tabs still remain compacted when closing using only the keyboard and I still have to mouse over the tab bar to make them snap back to the expected size.
Author
Owner

@zadjii-msft commented on GitHub (Oct 25, 2021):

What the heck, you're right. This was tracked in https://github.com/microsoft/microsoft-ui-xaml/issues/4971, which was supposed to be fixed in https://github.com/microsoft/microsoft-ui-xaml/pull/4980. Maybe the fix was literally only for the built in keyboard shortcut for closing tabs, ctrl+f4, which I don't think we even use at all.

@zadjii-msft commented on GitHub (Oct 25, 2021): What the heck, you're right. This was tracked in https://github.com/microsoft/microsoft-ui-xaml/issues/4971, which was supposed to be fixed in https://github.com/microsoft/microsoft-ui-xaml/pull/4980. Maybe the fix was literally only for the built in keyboard shortcut for closing tabs, ctrl+f4, which I don't think we even use at all.
Author
Owner

@StephenLPeters commented on GitHub (Oct 26, 2021):

Closing a tab via the close button is not suppose to resize the tabs until you move your cursor outside of the tab strip. This is so you can close many tabs by quickly pressing your mouse button as the tabs animate under your cursor. The bug here is that when a tab closes we assume that the pointer is over the tab strip and wait until the next pointer exited event to resize the tabs. The correct solution is to resize the tabs immediately if the pointer is not over the items.

@StephenLPeters commented on GitHub (Oct 26, 2021): Closing a tab via the close button is not suppose to resize the tabs until you move your cursor outside of the tab strip. This is so you can close many tabs by quickly pressing your mouse button as the tabs animate under your cursor. The bug here is that when a tab closes we assume that the pointer is over the tab strip and wait until the next pointer exited event to resize the tabs. The correct solution is to resize the tabs immediately if the pointer is not over the items.
Author
Owner

@beervoley commented on GitHub (Oct 31, 2021):

closed via https://github.com/microsoft/microsoft-ui-xaml/pull/6160
@zadjii-msft

@beervoley commented on GitHub (Oct 31, 2021): closed via https://github.com/microsoft/microsoft-ui-xaml/pull/6160 @zadjii-msft
Author
Owner

@zadjii-msft commented on GitHub (Aug 2, 2022):

@beervoley Are we sure that https://github.com/microsoft/microsoft-ui-xaml/pull/6160 fixed this? I just whipped up a Terminal build with 2.8 and this doesn't seem like it's fixed.

gh-9822-aug-2022

(the numberbox at the start of the gif shows that I've definitely got 2.8, b/c #13495 is fixed)

As I close tabs, they still don't seem to resize. Maybe it's a side effect of how we're removing the tab items from the list?

7976e48195/src/cascadia/TerminalApp/TabManagement.cpp (L532-L534)

But that seems... pretty straightforward.

@zadjii-msft commented on GitHub (Aug 2, 2022): @beervoley Are we _sure_ that https://github.com/microsoft/microsoft-ui-xaml/pull/6160 fixed this? I just whipped up [a Terminal build with 2.8](https://github.com/microsoft/terminal/compare/dev/migrie/mux-2.8-aug-2022) and this doesn't seem like it's fixed. ![gh-9822-aug-2022](https://user-images.githubusercontent.com/18356694/182419669-803672d0-0387-4980-a8b2-97fff9d8ee46.gif) (the numberbox at the start of the gif shows that I've definitely got 2.8, b/c #13495 is fixed) As I close tabs, they still don't seem to resize. Maybe it's a side effect of how we're removing the tab items from the list? https://github.com/microsoft/terminal/blob/7976e48195a569c87e37b7ca4861dfdcb7db0d7c/src/cascadia/TerminalApp/TabManagement.cpp#L532-L534 But that seems... pretty straightforward.
Author
Owner

@StephenLPeters commented on GitHub (Aug 2, 2022):

IDK why I looked at this, the email cought my eye, but this is also not correct: 9670f76906/dev/TabView/TabView.cpp (L780) It means that if your mouse happens to be over tab item one in the tab strip when you use keyboard to close tab 7 they wont resize. I don't think its the issue you are seeing though @zadjii-msft. @ranjeshj

@StephenLPeters commented on GitHub (Aug 2, 2022): IDK why I looked at this, the email cought my eye, but this is also not correct: https://github.com/microsoft/microsoft-ui-xaml/blob/9670f769069535175490ee611e8a1ddf3fffd094/dev/TabView/TabView.cpp#L780 It means that if your mouse happens to be over tab item one in the tab strip when you use keyboard to close tab 7 they wont resize. I don't think its the issue you are seeing though @zadjii-msft. @ranjeshj
Author
Owner

@beervoley commented on GitHub (Aug 2, 2022):

@beervoley Are we sure that microsoft/microsoft-ui-xaml#6160 fixed this? I just whipped up a Terminal build with 2.8 and this doesn't seem like it's fixed.

As I close tabs, they still don't seem to resize. Maybe it's a side effect of how we're removing the tab items from the list?

7976e48195/src/cascadia/TerminalApp/TabManagement.cpp (L532-L534)

But that seems... pretty straightforward.

yup, seeing the same
as @StephenLPeters outlined in a comment above - there's still a bug that if the cursor is over tabs and a tab is removed via keyboard - it still won't resize but that doesn't look what you're seeing.
image
not sure why this doesn't kick in: your pointer is clearly not over tabs so tabs width update should be triggered
@StephenLPeters any thoughts? going over it with debugger should point the issue right away

@beervoley commented on GitHub (Aug 2, 2022): > @beervoley Are we _sure_ that [microsoft/microsoft-ui-xaml#6160](https://github.com/microsoft/microsoft-ui-xaml/pull/6160) fixed this? I just whipped up [a Terminal build with 2.8](https://github.com/microsoft/terminal/compare/dev/migrie/mux-2.8-aug-2022) and this doesn't seem like it's fixed. > > > As I close tabs, they still don't seem to resize. Maybe it's a side effect of how we're removing the tab items from the list? > > https://github.com/microsoft/terminal/blob/7976e48195a569c87e37b7ca4861dfdcb7db0d7c/src/cascadia/TerminalApp/TabManagement.cpp#L532-L534 > > But that seems... pretty straightforward. yup, seeing the same as @StephenLPeters outlined in a comment above - there's still a bug that if the cursor is over tabs and a tab is removed via keyboard - it still won't resize but that doesn't look what you're seeing. ![image](https://user-images.githubusercontent.com/21356912/182445424-fca5e382-c526-4bbf-b278-865af1e3be85.png) not sure why this doesn't kick in: your pointer is clearly not over tabs so tabs width update should be triggered @StephenLPeters any thoughts? going over it with debugger should point the issue right away
Author
Owner

@StephenLPeters commented on GitHub (Aug 2, 2022):

I didn't see anything wrong with my cursory review, but maybe has to do with xaml island stuff? maybe we don't get a pointer exited because the tab well goes to the edge of the island?

@StephenLPeters commented on GitHub (Aug 2, 2022): I didn't see anything wrong with my cursory review, but maybe has to do with xaml island stuff? maybe we don't get a pointer exited because the tab well goes to the edge of the island?
Author
Owner

@beervoley commented on GitHub (Aug 2, 2022):

@ranjeshj the fix for this particular problem (not when cursor is still over tabs and a tab is closed via keyboard) is to change line 782 to UpdateTabWidths() instead of UpdateTabWidths(true, false) only if the user closed the tab via keyboard. This will force TabView to use all the available width to size the tabs. I don't know why we need fillAllAvailableSpace bool in UpdateTabWidths at all. Passing false to shouldUpdateTabWidths will "achieve" the same result in case we don't need to resize tabs while user's cursor is still located over them.
So to summarize:

  1. In case of tab closure via keyboard call UpdateTabWidths() on line 782.
  2. Keyboard close should be specially handled because if the user's cursor is located on the tabs and a tab is closed via keyboard - tabview won't resize.
@beervoley commented on GitHub (Aug 2, 2022): @ranjeshj the fix for this particular problem (not when cursor is still over tabs and a tab is closed via keyboard) is to change line 782 to `UpdateTabWidths()` instead of `UpdateTabWidths(true, false)` only if **the user closed the tab via keyboard**. This will force TabView to use all the available width to size the tabs. I don't know why we need `fillAllAvailableSpace` bool in `UpdateTabWidths` at all. Passing `false` to `shouldUpdateTabWidths` will "achieve" the same result in case we don't need to resize tabs while user's cursor is still located over them. So to summarize: 1) In case of tab closure via keyboard call `UpdateTabWidths()` on line 782. 2) Keyboard close should be specially handled because if the user's cursor is located on the tabs and a tab is closed via keyboard - tabview won't resize.
Author
Owner

@zadjii-msft commented on GitHub (Apr 3, 2023):

Upstream: https://github.com/microsoft/microsoft-ui-xaml/issues/8358

@zadjii-msft commented on GitHub (Apr 3, 2023): Upstream: https://github.com/microsoft/microsoft-ui-xaml/issues/8358
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13436