Home / Forums / How to handle text clipping and auto-scroll in custom Dear ImGui log consoles? [Discussion #8]

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Question

How to handle text clipping and auto-scroll in custom Dear ImGui log consoles? [Discussion #8]

SpanSpecialist
Zero-Copy Memory
MEMBER
Rep: 273
Join Date: Aug 2021
Posts: 7
Thanks: 33
5y ago · Aug 4, 2021 3:27 PM
#1
I am building an in-game debug console in Dear ImGui. How can I implement smooth auto-scrolling to the bottom when new logs arrive, while allowing the user to scroll up without fighting the view?
SpanSpecialist · Zero-Copy Memory
Span<T>, ReadOnlySpan<T>, and stackalloc for fast substring ...
The following users thanked SpanSpecialist for this post:
FastMath
SIMD Math Library
MEMBER
Rep: 49
Join Date: Dec 2025
Posts: 6
Thanks: 71
5y ago · Aug 4, 2021 5:09 PM
#2
Check ImGui::GetScrollY() >= ImGui::GetScrollMaxY() before adding new items! If the user was already at the bottom, call ImGui::SetScrollHereY(1.0f) after rendering the new log entries. If the user scrolled up to inspect previous logs, skip the SetScrollHereY call so the view stays fixed.
FastMath · SIMD Math Library
Header-only C++ matrix math library author. Fast vectors and...
RenderMaster
ImGui UI Designer
VIP
Rep: 310
Join Date: Sep 2023
Posts: 32
Thanks: 82
5y ago · Aug 4, 2021 10:09 PM
#3
Also use ImGuiListClipper for large log lists (10,000+ items)! It only renders the visible lines on screen, preventing framerate drops.
RenderMaster | Clean UI Design & Dear ImGui widgets