|
|
|
@ -7148,17 +7148,22 @@ void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id)
|
|
|
|
|
// Called on manual closure attempt
|
|
|
|
|
void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
|
|
|
|
{
|
|
|
|
|
if ((tab_bar->VisibleTabId == tab->ID) && !(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
|
|
|
|
if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
|
|
|
|
{
|
|
|
|
|
// This will remove a frame of lag for selecting another tab on closure.
|
|
|
|
|
// However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure
|
|
|
|
|
tab->LastFrameVisible = -1;
|
|
|
|
|
tab_bar->SelectedTabId = tab_bar->NextSelectedTabId = 0;
|
|
|
|
|
tab->WantClose = true;
|
|
|
|
|
if (tab_bar->VisibleTabId == tab->ID)
|
|
|
|
|
{
|
|
|
|
|
tab->LastFrameVisible = -1;
|
|
|
|
|
tab_bar->SelectedTabId = tab_bar->NextSelectedTabId = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ((tab_bar->VisibleTabId != tab->ID) && (tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Actually select before expecting closure
|
|
|
|
|
tab_bar->NextSelectedTabId = tab->ID;
|
|
|
|
|
// Actually select before expecting closure attempt (on an UnsavedDocument tab user is expect to e.g. show a popup)
|
|
|
|
|
if (tab_bar->VisibleTabId != tab->ID)
|
|
|
|
|
tab_bar->NextSelectedTabId = tab->ID;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|