From e489e40a853426767de9ce0637bc0c9ceb431c1e Mon Sep 17 00:00:00 2001 From: GamingMinds-DanielC Date: Mon, 15 May 2023 14:05:00 +0200 Subject: [PATCH] Clipper: Amend ecb0aaa (#6424, #3841) --- docs/CHANGELOG.txt | 4 ++-- imgui.cpp | 8 ++++---- imgui_internal.h | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 2f9ea03204f9..ae6b54d81b14 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -38,9 +38,9 @@ HOW TO UPDATE? Breaking changes: - Clipper: Commented out obsolete redirection constructor which was marked obsolete in 1.79: - 'ImGuiListClipper(int items_count, float items_height)' --> Use 'ImGuiListClipper() + clipper.Begin().clipper.Begin()'. + 'ImGuiListClipper(int items_count, float items_height)' --> Use 'ImGuiListClipper() + clipper.Begin()'. - Clipper: Renamed ForceDisplayRangeByIndices() to IncludeRangeByIndices(), kept - inline redirection function (introduced in 1.86 andrarely used). (#6424, #3841) + inline redirection function (introduced in 1.86 and rarely used). (#6424, #3841) - Backends: GLUT: Removed call to ImGui::NewFrame() from ImGui_ImplGLUT_NewFrame(). It needs to be called from the main app loop, like with every other backends. (#6337) [@GereonV] diff --git a/imgui.cpp b/imgui.cpp index 558710c43d3c..6632a521ac15 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2806,13 +2806,13 @@ void ImGuiListClipper::End() ItemsCount = -1; } -void ImGuiListClipper::IncludeRangeByIndices(int item_min, int item_max) +void ImGuiListClipper::IncludeRangeByIndices(int item_begin, int item_end) { ImGuiListClipperData* data = (ImGuiListClipperData*)TempData; IM_ASSERT(DisplayStart < 0); // Only allowed after Begin() and if there has not been a specified range yet. - IM_ASSERT(item_min <= item_max); - if (item_min < item_max) - data->Ranges.push_back(ImGuiListClipperRange::FromIndices(item_min, item_max)); + IM_ASSERT(item_begin <= item_end); + if (item_begin < item_end) + data->Ranges.push_back(ImGuiListClipperRange::FromIndices(item_begin, item_end)); } static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper) diff --git a/imgui_internal.h b/imgui_internal.h index f5befd332244..5d78f2c5db4c 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1404,6 +1404,7 @@ enum ImGuiInputFlags_ // [SECTION] Clipper support //----------------------------------------------------------------------------- +// Note that Max is exclusive, so perhaps should be using a Begin/End convention. struct ImGuiListClipperRange { int Min;