From 325563a982c0c2c889f02e771c82a848ed78ab22 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 20 Mar 2026 15:17:07 +0100 Subject: [PATCH] InputTextMultiline: InputTextMultiline: fixed an issue calculating lines count when active. Amend 4252275 --- docs/CHANGELOG.txt | 3 ++- imgui.cpp | 2 +- imgui_widgets.cpp | 5 +---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 8185b86c1..71a1bb173 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -84,7 +84,8 @@ Other Changes: - Fixed selection highlight Y1 offset being very slightly off (since 1.92.3). (#9311) [@v-ein] - InputTextMultiline: fixed an issue introduced in 1.92.3 where line count calculated for vertical scrollbar range would be +1 when the widget is inactive, word-wrap is - disabled and the text buffer ends with '\n'. + disabled and the text buffer ends with '\n'. Fixed a similar issue related to clipping + large amount of text. - Style: - Border sizes are now scaled (and rounded) by ScaleAllSizes(). - When using large values with ScallAllSizes(), the following items thickness diff --git a/imgui.cpp b/imgui.cpp index 26518852a..8e760d05a 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5565,7 +5565,7 @@ void ImGui::NewFrame() // As a result, custom widget using ButtonBehavior() _without_ ItemAdd() need to call KeepAliveID() themselves. if (g.ActiveId != 0 && g.ActiveIdIsAlive != g.ActiveId && g.ActiveIdPreviousFrame == g.ActiveId) { - IMGUI_DEBUG_LOG_ACTIVEID("NewFrame(): ClearActiveID() because it isn't marked alive anymore!\n"); + IMGUI_DEBUG_LOG_ACTIVEID("NewFrame(): ClearActiveID() 0x%08X because it isn't marked alive anymore!\n", g.ActiveId); ClearActiveID(); } diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 7e51511dc..c7159c125 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4629,11 +4629,8 @@ static int InputTextLineIndexBuild(ImGuiInputTextFlags flags, ImGuiTextIndex* li line_index->Offsets.push_back(0); size++; } - if (buf_end > buf && buf_end[-1] == '\n' && size <= max_output_buffer_size && !trailing_line_already_counted) - { + if (buf_end > buf && buf_end[-1] == '\n' && !trailing_line_already_counted && size++ <= max_output_buffer_size) line_index->Offsets.push_back((int)(buf_end - buf)); - size++; - } return size; }