Skip to content
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

Prevent multiple settings tabs from being persisted #17169

Merged
merged 1 commit into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/cascadia/TerminalApp/TerminalTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,23 @@ namespace winrt::TerminalApp::implementation

{
ActionAndArgs newTabAction{};
INewContentArgs newContentArgs{ state.firstPane->GetTerminalArgsForPane(kind) };

// Special case here: if there was one pane (which results in no actions
// being generated), and it was a settings pane, then promote that to an
// open settings action. The openSettings action itself has additional machinery
// to prevent multiple top-level settings tabs.
const auto wasSettings = state.args.empty() &&
(newContentArgs && newContentArgs.Type() == L"settings");
if (wasSettings)
{
newTabAction.Action(ShortcutAction::OpenSettings);
newTabAction.Args(OpenSettingsArgs{ SettingsTarget::SettingsUI });
return std::vector<ActionAndArgs>{ std::move(newTabAction) };
}

newTabAction.Action(ShortcutAction::NewTab);
NewTabArgs newTabArgs{ state.firstPane->GetTerminalArgsForPane(kind) };
newTabAction.Args(newTabArgs);
newTabAction.Args(NewTabArgs{ newContentArgs });

state.args.emplace(state.args.begin(), std::move(newTabAction));
}
Expand Down
Loading