Repository: microsoft/terminal (language: cpp)

Issue:
[1.21] You can have a restored settings tab and open a second settings tab
### Windows Terminal version

1.21.1011.0

### Windows build number

_No response_

### Other Software

_No response_

### Steps to reproduce

Enable session restoration. 

Open settings.

Close terminal.

Relaunch terminal.

Open settings again.

### Expected Behavior

_No response_

### Actual Behavior

![image](https://github.com/microsoft/terminal/assets/189190/8344f492-691b-4c8c-ae32-de222001ba2d)



Discussion / hints:
Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!


### Closed similar issues:
- [After updating to V1.12 restore on restart is missing (#12465)](https://github.com/microsoft/terminal/issues/12465),  similarity score: 0.75

> Note: You can give me feedback by thumbs upping or thumbs downing this comment.
You can do this an infinite number of times!
@zadjii-msft hah actually this applies to any newTab type:settings action. You can just keep doing it

Fix patch:
diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp
index e0a93ee9275..d3e52d4037d 100644
--- a/src/cascadia/TerminalApp/TerminalTab.cpp
+++ b/src/cascadia/TerminalApp/TerminalTab.cpp
@@ -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));
         }


Test patch: