From 046a8eae0ff0854864760b99e0776c904d80b74d Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 31 Jul 2025 22:04:01 +0900 Subject: [PATCH] Tabs: fixed tab bar underline not drawing below scroll buttons. (#6820, #4859, #5022, #5239) Fix ef8ff1b5d8 which accidentally meant we are using BarRect after it may have been modified by TabBarScrollingButtons(). --- docs/CHANGELOG.txt | 2 ++ imgui_widgets.cpp | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 9381e0185..d3c5d6609 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -51,6 +51,8 @@ Other Changes: often more convenient to use index in caller-code, whereas TableGetRowIndex() includes header rows). - Tables: fixed imgui_internal.h's TableGetHoveredRow() the same way. (#7350, #6588, #6250) +- Tabs: fixed tab bar underline not drawing below scroll buttons, when + they are enabled (minor regression from 1.90). (#6820, #4859, #5022, #5239) - Error Handling: minor improvements to error handling for TableGetSortSpecs() and TableSetBgColor() calls. (#1651, #8499) - Misc: fixed building with IMGUI_DISABLE_DEBUG_TOOLS only. (#8796) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 63dd9dc21..b4d5bc1d7 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -9429,8 +9429,8 @@ bool ImGui::BeginTabBar(const char* str_id, ImGuiTabBarFlags flags) ImGuiTabBar* tab_bar = g.TabBars.GetOrAddByKey(id); ImRect tab_bar_bb = ImRect(window->DC.CursorPos.x, window->DC.CursorPos.y, window->WorkRect.Max.x, window->DC.CursorPos.y + g.FontSize + g.Style.FramePadding.y * 2); tab_bar->ID = id; - tab_bar->SeparatorMinX = tab_bar->BarRect.Min.x - IM_TRUNC(window->WindowPadding.x * 0.5f); - tab_bar->SeparatorMaxX = tab_bar->BarRect.Max.x + IM_TRUNC(window->WindowPadding.x * 0.5f); + tab_bar->SeparatorMinX = tab_bar_bb.x - IM_TRUNC(window->WindowPadding.x * 0.5f); + tab_bar->SeparatorMaxX = tab_bar_bb.x + IM_TRUNC(window->WindowPadding.x * 0.5f); //if (g.NavWindow && IsWindowChildOf(g.NavWindow, window, false, false)) flags |= ImGuiTabBarFlags_IsFocused; return BeginTabBarEx(tab_bar, tab_bar_bb, flags); @@ -9668,7 +9668,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) tab_bar->WidthAllTabsIdeal += sections[section_n].Width + sections[section_n].Spacing; // Horizontal scrolling buttons - // (note that TabBarScrollButtons() will alter BarRect.Max.x) + // Important: note that TabBarScrollButtons() will alter BarRect.Max.x. if ((tab_bar->WidthAllTabsIdeal > tab_bar->BarRect.GetWidth() && tab_bar->Tabs.Size > 1) && !(tab_bar->Flags & ImGuiTabBarFlags_NoTabListScrollingButtons) && (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll)) if (ImGuiTabItem* scroll_and_select_tab = TabBarScrollingButtons(tab_bar)) {