Tables: Headers: fixed label being clipped early to reserve space for a sort marker even when no sort marker is displayed. Amend 892b48e2d6: while fixing auto fit this was ditched.
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 4f600ed..eb1e842 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt
@@ -58,6 +58,9 @@ - Tables: - Context Menu: added a "Reset" sub-menu with a "Reset Visibility" option. (which is greyed out when using default settings) + - Headers: fixed label being clipped early to reserve space for a sort marker + even when no sort marker is displayed. Auto-fitting a column still accounts + for the possible marker, so that sorting after an auto-fit doesn't clip the label. - Fonts: - Added `IMGUI_DISABLE_DEFAULT_FONT_BITMAP`/`IMGUI_DISABLE_DEFAULT_FONT_VECTOR` to disable embedding either fonts separately. (#9407)
diff --git a/imgui_tables.cpp b/imgui_tables.cpp index a306a00..405f685 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp
@@ -3288,7 +3288,9 @@ } // Sort order arrow - const float ellipsis_max = ImMax(cell_r.Max.x - w_arrow - w_sort_text, label_pos.x); + // - Only clip label for a visible arrow. Auto-fit still accounts for a possible arrow, but when + // manually sized smaller we don't clip the label for the sake of an arrow that isn't displayed. + const float ellipsis_max = ImMax(cell_r.Max.x - (sort_arrow ? w_arrow + w_sort_text : 0.0f), label_pos.x); if ((table->Flags & ImGuiTableFlags_Sortable) && !(column->Flags & ImGuiTableColumnFlags_NoSort)) { if (column->SortOrder != -1)