Skip to content
Draft
Show file tree
Hide file tree
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: 14 additions & 4 deletions src/cascadia/TerminalApp/AppActionHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,25 @@
return;
}

const auto& duplicateFromTab{ realArgs.SplitMode() == SplitType::Duplicate ? _GetFocusedTab() : nullptr };

const auto& terminalTab{ _senderOrFocusedTab(sender) };

_SplitPane(terminalTab,
const auto& duplicateFromTab { realArgs.SplitMode() == SplitType::Duplicate ? _GetFocusedTab() : nullptr };
// The tab is not focused yet if we just created the tab, hacky workaround want to get feedback on if ive missed a edge cas ebefore cleaning up

Check warning on line 284 in src/cascadia/TerminalApp/AppActionHandlers.cpp

View workflow job for this annotation

GitHub Actions / Check Spelling

`ebefore` is not a recognized word. (unrecognized-spelling)
if (!duplicateFromTab && terminalTab.get())
{
_SplitPane(terminalTab,
realArgs.SplitDirection(),
// This is safe, we're already filtering so the value is (0, 1)
realArgs.SplitSize(),
_MakePane(realArgs.ContentArgs(), *terminalTab.get()));
}
Comment on lines +285 to +292
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So i came up with a way that works (fallback to terminalTab which is the 'sender/focused tab' as getFocused will always be null for the case described above;

@carlos-zamora i've done a bit of testing but do you think i might be missing a edge case where this would cause a bug?

else
{
_SplitPane(terminalTab,
realArgs.SplitDirection(),
// This is safe, we're already filtering so the value is (0, 1)
realArgs.SplitSize(),
_MakePane(realArgs.ContentArgs(), duplicateFromTab));
}
args.Handled(true);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/TabManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ namespace winrt::TerminalApp::implementation

// This call to _MakePane won't return nullptr, we already checked that
// case above with the _maybeElevate call.
// _MakePane
_CreateNewTabFromPane(_MakePane(newContentArgs, nullptr));
return S_OK;
}
Expand Down
13 changes: 13 additions & 0 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3285,6 +3285,19 @@ namespace winrt::TerminalApp::implementation
{
controlSettings.DefaultSettings().StartingDirectory(workingDirectory);
}
// Copy Title and Color of tab you split
controlSettings.DefaultSettings().StartingTitle(terminalTab->Title());
const auto color = terminalTab->GetTabColor();
if (color.has_value())
{
const auto& rawColor = color.value();
controlSettings.DefaultSettings().StartingTabColor(
winrt::Microsoft::Terminal::Core::Color{
rawColor.R,
rawColor.G,
rawColor.B,
rawColor.A });
}
}
}
if (!profile)
Expand Down
Loading