[Quick and Dirty] Copy runtime tab title when duplicating tabs (#9813)

## PR Checklist
* [x] Closes https://github.com/microsoft/terminal/issues/9723
* [x] CLA signed. 
* [ ] Tests added/passed
* [ ] Documentation updated.
* [ ] Schema updated.
* [ ] I've discussed this with core contributors already.

## Detailed Description of the Pull Request / Additional comments
Quick and dirty. 
A better solution is to allow passing all "runtime settings" upon tab creation.
This commit is contained in:
Don-Vito 2021-04-21 13:54:18 +03:00 committed by GitHub
parent ad34291632
commit ad625a041d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View file

@ -323,6 +323,15 @@ namespace winrt::TerminalApp::implementation
}
_CreateNewTabFromSettings(profileGuid.value(), settingsCreateResult);
const auto runtimeTabText{ tab.GetTabText() };
if (!runtimeTabText.empty())
{
if (auto newTab{ _GetFocusedTabImpl() })
{
newTab->SetTabText(runtimeTabText);
}
}
}
}
CATCH_LOG();

View file

@ -510,6 +510,11 @@ namespace winrt::TerminalApp::implementation
UpdateTitle();
}
winrt::hstring TerminalTab::GetTabText() const
{
return _runtimeTabText;
}
void TerminalTab::ResetTabText()
{
_runtimeTabText = L"";

View file

@ -61,6 +61,7 @@ namespace winrt::TerminalApp::implementation
void ClosePane();
void SetTabText(winrt::hstring title);
winrt::hstring GetTabText() const;
void ResetTabText();
void ActivateTabRenamer();