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.
This commit is contained in:
ocornut
2026-06-12 18:22:45 +02:00
parent e5ff2d07d7
commit 924f57181b
2 changed files with 6 additions and 1 deletions

View File

@@ -58,6 +58,9 @@ Other Changes:
- 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)

View File

@@ -3288,7 +3288,9 @@ void ImGui::TableHeader(const char* label)
}
// 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)