Limiting Columns()/BeginColumns() api to 64 columns (#125)
While the current code technically supports it, future code may not so we're putting the restriction ahead.
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index 13e3cec..c9ff9b2 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -55,6 +55,8 @@
documented (can only unreserve from the last reserve call). If you suspect you ever
used that feature before, #define IMGUI_DEBUG_PARANOID in imconfig.h to catch existing
calls. [@ShironekoBen]
+- Limiting Columns()/BeginColumns() api to 64 columns with an assert. While the current code
+ technically supports it, future code may not so we're putting the restriction ahead.
- imgui_internal.h: changed ImRect() default constructor initializes all fields to 0.0f instead
of (FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX). If you used ImRect::Add() to create bounding boxes by
adding multiple points into it, you may need to fix your initial value.
diff --git a/imgui.cpp b/imgui.cpp
index 3095784..dff12b6 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -353,6 +353,7 @@
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
+ - 2019/12/17 (1.75) - made Columns() limited to 64 columns by asserting above that limit. While the current code technically supports it, future code may not so we're putting the restriction ahead.
- 2019/12/13 (1.75) - [imgui_internal.h] changed ImRect() default constructor initializes all fields to 0.0f instead of (FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX). If you used ImRect::Add() to create bounding boxes by adding multiple points into it, you may need to fix your initial value.
- 2019/12/08 (1.75) - removed redirecting functions/enums that were marked obsolete in 1.53 (December 2017):
- ShowTestWindow() -> use ShowDemoWindow()
diff --git a/imgui.h b/imgui.h
index 13150f1..704a721 100644
--- a/imgui.h
+++ b/imgui.h
@@ -584,6 +584,7 @@
// Columns
// - You can also use SameLine(pos_x) to mimic simplified columns.
// - The columns API is work-in-progress and rather lacking (columns are arguably the worst part of dear imgui at the moment!)
+ // - There is a maximum of 64 columns.
// - By end of the 2019 we will expose a new 'Table' api which will replace columns.
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border = true);
IMGUI_API void NextColumn(); // next column, defaults to current row or next row if the current row is finished
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index d605e2d..684dbe5 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -7411,8 +7411,8 @@
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow();
- IM_ASSERT(columns_count >= 1);
- IM_ASSERT(window->DC.CurrentColumns == NULL); // Nested columns are currently not supported
+ IM_ASSERT(columns_count >= 1 && columns_count <= 64); // Maximum 64 columns
+ IM_ASSERT(window->DC.CurrentColumns == NULL); // Nested columns are currently not supported
// Acquire storage for the columns set
ImGuiID id = GetColumnsID(str_id, columns_count);