From 80b3ab7d3e09185355727aa42b69652b9afc3b97 Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 22 Sep 2019 22:16:05 +0200 Subject: [PATCH] TabBar: Fixed single tab shrinking reducing the tab to 0.0f size. Broken by a856c670c17fe70d61e519bf74ccb2559915a2ff. --- imgui_widgets.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 042af866..ca84674a 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1366,7 +1366,7 @@ void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_exc { if (count == 1) { - items[0].Width -= width_excess; + items[0].Width = ImMax(items[0].Width - width_excess, 1.0f); return; } ImQsort(items, (size_t)count, sizeof(ImGuiShrinkWidthItem), ShrinkWidthItemComparer); @@ -6562,6 +6562,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) { ImGuiTabItem* tab = &tab_bar->Tabs[tab_n]; tab->Width = ImMin(tab->WidthContents, tab_max_width); + IM_ASSERT(tab->Width > 0.0f); } }