From 0aee174e680d889fd6d9ddba6f037002d6f79fdd Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Tue, 16 Sep 2025 20:09:56 +0200 Subject: [PATCH] Fix behavior of split-pane for existing windows (#19347) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #18815 ## Validation Steps Performed * `wt -w 0 sp` splits the current tab ✅ --- src/cascadia/TerminalApp/Remoting.cpp | 4 ---- src/cascadia/TerminalApp/TerminalWindow.cpp | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cascadia/TerminalApp/Remoting.cpp b/src/cascadia/TerminalApp/Remoting.cpp index 078a0d7f11..93cab7819a 100644 --- a/src/cascadia/TerminalApp/Remoting.cpp +++ b/src/cascadia/TerminalApp/Remoting.cpp @@ -44,10 +44,6 @@ namespace winrt::TerminalApp::implementation { _args = { value.begin(), value.end() }; _parseResult = _parsed.ParseArgs(_args); - if (_parseResult == 0) - { - _parsed.ValidateStartupCommands(); - } } winrt::com_array CommandlineArgs::Commandline() diff --git a/src/cascadia/TerminalApp/TerminalWindow.cpp b/src/cascadia/TerminalApp/TerminalWindow.cpp index 4b97e9581d..2bb8cca2cf 100644 --- a/src/cascadia/TerminalApp/TerminalWindow.cpp +++ b/src/cascadia/TerminalApp/TerminalWindow.cpp @@ -1050,6 +1050,11 @@ namespace winrt::TerminalApp::implementation // (or called TerminalWindow::Initialize) if (_appArgs->ExitCode() == 0) { + // The existing logic (before this commit) strictly relied on + // ValidateStartupCommands() only to be called for new windows. + // It modifies the actions it stores. + parsedArgs.ValidateStartupCommands(); + // If the size of the arguments list is 1, // then it contains only the executable name and no other arguments. _hasCommandLineArguments = _appArgs->CommandlineRef().size() > 1;