mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-19 09:58:08 -05:00
Standardize on Tab::Close for closing tabs (#19656)
This makes it possible to subscribe to `Close` events.
This commit is contained in:
@@ -933,6 +933,13 @@ namespace winrt::TerminalApp::implementation
|
||||
return res;
|
||||
}
|
||||
|
||||
void Tab::Close()
|
||||
{
|
||||
ASSERT_UI_THREAD();
|
||||
|
||||
Closed.raise(nullptr, nullptr);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Prepares this tab for being removed from the UI hierarchy by shutting down all active connections.
|
||||
void Tab::Shutdown()
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void UpdateSettings(const winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings& settings);
|
||||
void UpdateTitle();
|
||||
|
||||
void Close();
|
||||
void Shutdown();
|
||||
void ClosePane();
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace TerminalApp
|
||||
UInt32 TabViewNumTabs;
|
||||
|
||||
void Focus(Windows.UI.Xaml.FocusState focusState);
|
||||
void Close();
|
||||
void Shutdown();
|
||||
|
||||
void SetDispatch(ShortcutActionDispatch dispatch);
|
||||
|
||||
@@ -411,13 +411,11 @@ namespace winrt::TerminalApp::implementation
|
||||
auto actions = t->BuildStartupActions(BuildStartupKind::None);
|
||||
_AddPreviouslyClosedPaneOrTab(std::move(actions));
|
||||
|
||||
_RemoveTab(tab);
|
||||
tab.Close();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Removes the tab (both TerminalControl and XAML)
|
||||
// Arguments:
|
||||
// - tab: the tab to remove
|
||||
// Removes the tab (both TerminalControl and XAML).
|
||||
// NOTE: Don't call this directly, but rather `tab.Close()`.
|
||||
void TerminalPage::_RemoveTab(const winrt::TerminalApp::Tab& tab)
|
||||
{
|
||||
uint32_t tabIndex{};
|
||||
|
||||
Reference in New Issue
Block a user