From cbe03e3108386c5b4f4c28b5399f5ab34f4ba797 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 30 Jul 2016 11:22:18 +0200 Subject: [PATCH] Nav: CalcListClipping/ImGuiListClipper: fix to ensure we can navigate clipped lists (#323) --- imgui.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 3a8dc7c8..01aa4659 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3509,6 +3509,11 @@ void ImGui::CalcListClipping(int items_count, float items_height, int* out_items const ImVec2 pos = window->DC.CursorPos; int start = (int)((window->ClipRect.Min.y - pos.y) / items_height); int end = (int)((window->ClipRect.Max.y - pos.y) / items_height); + if (g.NavMoveRequest && g.NavMoveDir == ImGuiNavDir_N) // When performing a navigation request, ensure we have one item extra in the direction we are moving to + start--; + if (g.NavMoveRequest && g.NavMoveDir == ImGuiNavDir_S) + end++; + start = ImClamp(start, 0, items_count); end = ImClamp(end + 1, start, items_count); *out_items_display_start = start;