From bdc4dfebf5aee85f2a1d5449c7675e0cc30a053c Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 4 Sep 2023 12:10:31 +0200 Subject: [PATCH] Tables: Amend support for cross-cell SameLine() for first column. Amend 9a93fb5 + 8f5ce73. --- imgui_tables.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 1e938cec..26fa7ec9 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -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); @@ -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); @@ -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;