Tab menu: show "restart" + maintain items' enable state#19972
Tab menu: show "restart" + maintain items' enable state#19972carlos-zamora wants to merge 2 commits intomainfrom
Conversation
| // Snippets Pane can technically be split | ||
| _splitTabMenuItem.IsEnabled(isTerm || (content && content.try_as<winrt::TerminalApp::SnippetsPaneContent>() != nullptr)); |
There was a problem hiding this comment.
Frankly, snippets pane should be a side-car like terminal chat
src/cascadia/TerminalApp/Tab.cpp
Outdated
| } | ||
|
|
||
| Controls::MenuFlyoutItem splitTabMenuItem; | ||
| Controls::MenuFlyoutItem splitTabMenuItem = _splitTabMenuItem; |
There was a problem hiding this comment.
don't do this; just use _splitTabMenuItem directly for the duration.
src/cascadia/TerminalApp/Tab.cpp
Outdated
| } | ||
|
|
||
| Controls::MenuFlyoutItem splitTabMenuItem; | ||
| Controls::MenuFlyoutItem splitTabMenuItem = _splitTabMenuItem; |
There was a problem hiding this comment.
either that or create them here as locals and then std::move them into their _underscore versions
src/cascadia/TerminalApp/Tab.cpp
Outdated
| } | ||
|
|
||
| Controls::MenuFlyoutItem splitTabMenuItem; | ||
| Controls::MenuFlyoutItem splitTabMenuItem = _splitTabMenuItem; |
There was a problem hiding this comment.
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
|
Decided to use the members directly. The All personal preference, but willing to change it if you have a strong opinion. |
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