|
@@ -7552,7 +7552,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|
|
// and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window.
|
|
|
const char* tab_name = tab_bar->GetTabName(tab);
|
|
|
const bool has_close_button = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) ? false : true;
|
|
|
- tab->ContentWidth = (tab->RequestedWidth > 0.0f) ? tab->RequestedWidth : TabItemCalcSize(tab_name, has_close_button).x;
|
|
|
+ tab->ContentWidth = (tab->RequestedWidth >= 0.0f) ? tab->RequestedWidth : TabItemCalcSize(tab_name, has_close_button).x;
|
|
|
|
|
|
int section_n = TabItemGetSectionIdx(tab);
|
|
|
ImGuiTabBarSection* section = §ions[section_n];
|
|
@@ -7564,9 +7564,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|
|
ImGuiShrinkWidthItem* shrink_width_item = &g.ShrinkWidthBuffer[shrink_buffer_indexes[section_n]++];
|
|
|
shrink_width_item->Index = tab_n;
|
|
|
shrink_width_item->Width = shrink_width_item->InitialWidth = tab->ContentWidth;
|
|
|
-
|
|
|
- IM_ASSERT(tab->ContentWidth > 0.0f);
|
|
|
- tab->Width = tab->ContentWidth;
|
|
|
+ tab->Width = ImMax(tab->ContentWidth, 1.0f);
|
|
|
}
|
|
|
|
|
|
// Compute total ideal width (used for e.g. auto-resizing a window)
|
|
@@ -7610,6 +7608,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|
|
if (shrinked_width < 0.0f)
|
|
|
continue;
|
|
|
|
|
|
+ shrinked_width = ImMax(1.0f, shrinked_width);
|
|
|
int section_n = TabItemGetSectionIdx(tab);
|
|
|
sections[section_n].Width -= (tab->Width - shrinked_width);
|
|
|
tab->Width = shrinked_width;
|
|
@@ -8085,7 +8084,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|
|
if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasWidth)
|
|
|
size.x = tab->RequestedWidth = g.NextItemData.Width;
|
|
|
if (tab_is_new)
|
|
|
- tab->Width = size.x;
|
|
|
+ tab->Width = ImMax(1.0f, size.x);
|
|
|
tab->ContentWidth = size.x;
|
|
|
tab->BeginOrder = tab_bar->TabsActiveCount++;
|
|
|
|