diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index d10d52cb5..6d9b0bf8c 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -97,6 +97,9 @@ Other Changes: next row in such state where subsequent SameLine() would move back to previous row. - Tabs: Fixed a crash when closing multiple windows (possible with docking only) with an appended TabItemButton(). (#5515, #3291) [@rokups] +- Tabs: Fixed shrinking policy leading to infinite loops when fed unrounded tab widths. (#5652) +- Tabs: Fixed shrinking policy sometimes erroneously making right-most tabs stray a little out + bar boundaries (bug in 1.88). (#5652). - Window: Fixed a potential crash when appending to a child window. (#5515, #3496, #4797) [@rokups] - IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey can apply to mouse data as well. (#4921) diff --git a/imgui.h b/imgui.h index 7dad612d7..ed877330b 100644 --- a/imgui.h +++ b/imgui.h @@ -65,7 +65,7 @@ Index of this file: // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) #define IMGUI_VERSION "1.89 WIP" -#define IMGUI_VERSION_NUM 18816 +#define IMGUI_VERSION_NUM 18817 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_HAS_TABLE diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 6827f1ef7..ac4a61ca6 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1575,8 +1575,8 @@ void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_exc width_excess += items[n].Width - width_rounded; items[n].Width = width_rounded; } - while (width_excess > 0.0f) - for (int n = 0; n < count; n++) + while (width_excess >= 1.0f) + for (int n = 0; n < count && width_excess >= 1.0f; n++) if (items[n].Width + 1.0f <= items[n].InitialWidth) { items[n].Width += 1.0f; @@ -7596,7 +7596,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) width_excess = (section_0_w + section_2_w) - tab_bar->BarRect.GetWidth(); // Excess used to shrink leading/trailing section // With ImGuiTabBarFlags_FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore - if (width_excess > 0.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible)) + if (width_excess >= 1.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible)) { int shrink_data_count = (central_section_is_visible ? sections[1].TabCount : sections[0].TabCount + sections[2].TabCount); int shrink_data_offset = (central_section_is_visible ? sections[0].TabCount + sections[2].TabCount : 0);