Skip to content

Tab menu: show "restart" + maintain items' enable state#19972

Open
carlos-zamora wants to merge 1 commit intomainfrom
dev/cazamor/disable-tab-menu-items
Open

Tab menu: show "restart" + maintain items' enable state#19972
carlos-zamora wants to merge 1 commit intomainfrom
dev/cazamor/disable-tab-menu-items

Conversation

@carlos-zamora
Copy link
Member

Summary of the Pull Request

Changes how/when we display the "restart connection" item in the tab's context menu. Now, we always display it, but it's disabled if we're not in a terminal tab.

Applies similar enable/disable logic to the rest of the menu items. Previous to this, they just wouldn't do anything (which is fair, they didn't make any sense).

Validation Steps Performed

Check tab's menu in following scenarios:
✅ terminal pane
✅ settings tab
✅ snippets pane

Closes #18891

@carlos-zamora carlos-zamora changed the title Tab menu: show 'restart' + maintain items' enable state Tab menu: show "restart" + maintain items' enable state Mar 13, 2026
Comment on lines +1358 to +1359
// Snippets Pane can technically be split
_splitTabMenuItem.IsEnabled(isTerm || (content && content.try_as<winrt::TerminalApp::SnippetsPaneContent>() != nullptr));
Copy link
Member Author

Choose a reason for hiding this comment

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

Frankly, snippets pane should be a side-car like terminal chat

});
}

_UpdateMenuItemEnablement();
Copy link
Member

Choose a reason for hiding this comment

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

nit: MenuItemStates may be clearer and more future-proof

}

Controls::MenuFlyoutItem splitTabMenuItem;
Controls::MenuFlyoutItem splitTabMenuItem = _splitTabMenuItem;
Copy link
Member

Choose a reason for hiding this comment

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

don't do this; just use _splitTabMenuItem directly for the duration.

}

Controls::MenuFlyoutItem splitTabMenuItem;
Controls::MenuFlyoutItem splitTabMenuItem = _splitTabMenuItem;
Copy link
Member

Choose a reason for hiding this comment

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

either that or create them here as locals and then std::move them into their _underscore versions

}

Controls::MenuFlyoutItem splitTabMenuItem;
Controls::MenuFlyoutItem splitTabMenuItem = _splitTabMenuItem;
Copy link
Member

Choose a reason for hiding this comment

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

doubly-alternatively: you could consider just having a std::vector<MenuFlyoutItem> for the menu items you specifically want to enable when a TermControl is focused. you can then just enumerate them

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New action Restart this tab in the tab's topbar context menu

2 participants