From daecfffefbc729f80c3380c838901b6618530fb0 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 15 Apr 2024 12:52:45 +0200 Subject: [PATCH] Text, DrawList: Improved handling of long single-line wrapped text. (#7496, #5720) --- docs/CHANGELOG.txt | 2 ++ imgui_draw.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 408ed0f3f..189c9f5cc 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -43,6 +43,8 @@ Breaking changes: Other changes: +- Text, DrawList: Improved handling of long single-line wrapped text. Faster and + mitigitate issues with reading vertex indexing limits with 16-bit indices. - Backends: SDL3: Fixed text inputs. Re-enable calling SDL_StartTextInput()/SDL_StopTextInput() as SDL3 no longer enables it by default. (#7452, #6306, #6071, #1953) [@Green-Sky] diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 93be40cc7..f3da38519 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -4080,6 +4080,8 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im { x = start_x; y += line_height; + if (y > clip_rect.w) + break; // break out of main loop word_wrap_eol = NULL; s = CalcWordWrapNextLineStartA(s, text_end); // Wrapping skips upcoming blanks continue;