Skip to content

Commit

Permalink
Tables: Amend support for cross-cell SameLine() for first column. Amend
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Sep 4, 2023
1 parent 9a93fb5 commit bdc4dfe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion imgui_tables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,6 @@ void ImGui::TableNextRow(ImGuiTableRowFlags row_flags, float row_min_height)

// We honor min_row_height requested by user, but cannot guarantee per-row maximum height,
// because that would essentially require a unique clipping rectangle per-cell.
table->CellPaddingY = g.Style.CellPadding.y;
table->RowPosY2 += table->CellPaddingY * 2.0f;
table->RowPosY2 = ImMax(table->RowPosY2, table->RowPosY1 + row_min_height);

Expand All @@ -1761,6 +1760,7 @@ void ImGui::TableNextRow(ImGuiTableRowFlags row_flags, float row_min_height)
// [Internal] Called by TableNextRow()
void ImGui::TableBeginRow(ImGuiTable* table)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = table->InnerWindow;
IM_ASSERT(!table->IsInsideRow);

Expand All @@ -1779,7 +1779,10 @@ void ImGui::TableBeginRow(ImGuiTable* table)
table->RowPosY1 = table->RowPosY2 = next_y1;
table->RowTextBaseline = 0.0f;
table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent
table->CellPaddingY = g.Style.CellPadding.y;

window->DC.PrevLineTextBaseOffset = 0.0f;
window->DC.CursorPosPrevLine = ImVec2(window->DC.CursorPos.x, window->DC.CursorPos.y + table->CellPaddingY); // This allows users to call SameLine() to share LineSize between columns.
window->DC.PrevLineSize = window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); // This allows users to call SameLine() to share LineSize between columns, and to call it from first column too.
window->DC.IsSameLine = window->DC.IsSetPos = false;
window->DC.CursorMaxPos.y = next_y1;
Expand Down

0 comments on commit bdc4dfe

Please sign in to comment.