-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Tab menu: show "restart" + maintain items' enable state #19972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,6 @@ namespace winrt::TerminalApp::implementation | |
| _activePane = nullptr; | ||
|
|
||
| _closePaneMenuItem.Visibility(WUX::Visibility::Collapsed); | ||
| _restartConnectionMenuItem.Visibility(WUX::Visibility::Collapsed); | ||
|
|
||
| auto firstId = _nextPaneId; | ||
|
|
||
|
|
@@ -86,6 +85,7 @@ namespace winrt::TerminalApp::implementation | |
|
|
||
| _MakeTabViewItem(); | ||
| _CreateContextMenu(); | ||
| _UpdateMenuItemEnablement(); | ||
|
|
||
| _headerControl.TabStatus(_tabStatus); | ||
|
|
||
|
|
@@ -1271,13 +1271,6 @@ namespace winrt::TerminalApp::implementation | |
|
|
||
| _tabStatus.IsConnectionClosed(isClosed); | ||
| } | ||
|
|
||
| if (_activePane) | ||
| { | ||
| _restartConnectionMenuItem.Visibility(_activePane->IsConnectionClosed() ? | ||
| WUX::Visibility::Visible : | ||
| WUX::Visibility::Collapsed); | ||
| } | ||
| } | ||
|
|
||
| void Tab::_RestartActivePaneConnection() | ||
|
|
@@ -1348,6 +1341,22 @@ namespace winrt::TerminalApp::implementation | |
| } | ||
| }); | ||
| } | ||
|
|
||
| _UpdateMenuItemEnablement(); | ||
| } | ||
|
|
||
| void Tab::_UpdateMenuItemEnablement() | ||
| { | ||
| // Terminal-specific menu items | ||
| const auto content = _activePane ? _activePane->GetContent() : nullptr; | ||
| const auto isTerm = content && content.try_as<winrt::TerminalApp::TerminalPaneContent>() != nullptr; | ||
| _duplicateTabMenuItem.IsEnabled(isTerm); | ||
| _exportTabMenuItem.IsEnabled(isTerm); | ||
| _findMenuItem.IsEnabled(isTerm); | ||
| _restartConnectionMenuItem.IsEnabled(isTerm); | ||
|
|
||
| // Snippets Pane can technically be split | ||
| _splitTabMenuItem.IsEnabled(isTerm || (content && content.try_as<winrt::TerminalApp::SnippetsPaneContent>() != nullptr)); | ||
|
Comment on lines
+1358
to
+1359
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Frankly, snippets pane should be a side-car like terminal chat |
||
| } | ||
|
|
||
| // Method Description: | ||
|
|
@@ -1652,7 +1661,7 @@ namespace winrt::TerminalApp::implementation | |
| Automation::AutomationProperties::SetHelpText(renameTabMenuItem, renameTabToolTip); | ||
| } | ||
|
|
||
| Controls::MenuFlyoutItem duplicateTabMenuItem; | ||
| Controls::MenuFlyoutItem duplicateTabMenuItem = _duplicateTabMenuItem; | ||
| { | ||
| // "Duplicate tab" | ||
| Controls::FontIcon duplicateTabSymbol; | ||
|
|
@@ -1669,7 +1678,7 @@ namespace winrt::TerminalApp::implementation | |
| Automation::AutomationProperties::SetHelpText(duplicateTabMenuItem, duplicateTabToolTip); | ||
| } | ||
|
|
||
| Controls::MenuFlyoutItem splitTabMenuItem; | ||
| Controls::MenuFlyoutItem splitTabMenuItem = _splitTabMenuItem; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't do this; just use
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. either that or create them here as locals and then
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doubly-alternatively: you could consider just having a |
||
| { | ||
| // "Split tab" | ||
| Controls::FontIcon splitTabSymbol; | ||
|
|
@@ -1698,7 +1707,7 @@ namespace winrt::TerminalApp::implementation | |
| Automation::AutomationProperties::SetHelpText(closePaneMenuItem, closePaneToolTip); | ||
| } | ||
|
|
||
| Controls::MenuFlyoutItem exportTabMenuItem; | ||
| Controls::MenuFlyoutItem exportTabMenuItem = _exportTabMenuItem; | ||
| { | ||
| // "Export tab" | ||
| Controls::FontIcon exportTabSymbol; | ||
|
|
@@ -1715,7 +1724,7 @@ namespace winrt::TerminalApp::implementation | |
| Automation::AutomationProperties::SetHelpText(exportTabMenuItem, exportTabToolTip); | ||
| } | ||
|
|
||
| Controls::MenuFlyoutItem findMenuItem; | ||
| Controls::MenuFlyoutItem findMenuItem = _findMenuItem; | ||
| { | ||
| // "Find" | ||
| Controls::FontIcon findSymbol; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
MenuItemStatesmay be clearer and more future-proof