From 18a243bef04bdcae699305fd63571fb4a60b8e19 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 6 Apr 2018 17:50:50 +0200 Subject: [PATCH] Columns: Fixed calling Columns() again with the same number of columns. (#125) --- imgui.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index dc1ff923..66c8fce9 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -12705,11 +12705,15 @@ void ImGui::Columns(int columns_count, const char* id, bool border) { ImGuiWindow* window = GetCurrentWindow(); IM_ASSERT(columns_count >= 1); - if (window->DC.ColumnsSet != NULL && window->DC.ColumnsSet->Count != columns_count) - EndColumns(); - + ImGuiColumnsFlags flags = (border ? 0 : ImGuiColumnsFlags_NoBorder); //flags |= ImGuiColumnsFlags_NoPreserveWidths; // NB: Legacy behavior + if (window->DC.ColumnsSet != NULL && window->DC.ColumnsSet->Count == columns_count && window->DC.ColumnsSet->Flags == flags) + return; + + if (window->DC.ColumnsSet != NULL) + EndColumns(); + if (columns_count != 1) BeginColumns(id, columns_count, flags); }