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