Skip to content

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

Open
carlos-zamora wants to merge 2 commits intomainfrom
dev/cazamor/disable-tab-menu-items
Open

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

Conversation

@carlos-zamora
Copy link
Copy Markdown
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
Copy Markdown
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

}

Controls::MenuFlyoutItem splitTabMenuItem;
Controls::MenuFlyoutItem splitTabMenuItem = _splitTabMenuItem;
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@carlos-zamora
Copy link
Copy Markdown
Member Author

Decided to use the members directly. The std::move thing would be a hybrid approach since we still need to reference them at the end of the function to add them to the flyout. And the std::vector is nice for iteration, but I didn't like that there was special handling "restart connection" since the snippets pane is weird.

All personal preference, but willing to change it if you have a strong opinion.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 23, 2026
@carlos-zamora carlos-zamora requested a review from DHowett March 30, 2026 18:01
@carlos-zamora carlos-zamora enabled auto-merge (squash) March 31, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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