From e49d31a1c9988e5379b55f8bea97c062e1f1a844 Mon Sep 17 00:00:00 2001 From: lukaasm Date: Mon, 17 Apr 2023 23:02:36 +0200 Subject: [PATCH] Tables: do not show empty tooltip when user submits TableHeader with no label to display. (#6342) --- docs/CHANGELOG.txt | 2 ++ imgui_tables.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index aaec7c70a..85f05c8a2 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -42,6 +42,8 @@ Breaking changes: Other changes: +- Tables: Fixed a small miscalculation in TableHeader() leading to an empty tooltip + showing when a sorting column has no visible name. (#6342) [@lukaasm] - Backends: Clear bits sets io.BackendFlags on backend Shutdown(). (#6334, #6335] [@GereonV] Potentially this would facilitate switching runtime backend mid-session. diff --git a/imgui_tables.cpp b/imgui_tables.cpp index a61a04f37..012235a3b 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -3007,7 +3007,7 @@ void ImGui::TableHeader(const char* label) } // Sort order arrow - const float ellipsis_max = cell_r.Max.x - w_arrow - w_sort_text; + const float ellipsis_max = ImMax(cell_r.Max.x - w_arrow - w_sort_text, label_pos.x); if ((table->Flags & ImGuiTableFlags_Sortable) && !(column->Flags & ImGuiTableColumnFlags_NoSort)) { if (column->SortOrder != -1)