From 7f1e2bb8ddf72a16a89f62fb60d0bd0b93c13c44 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 12 Sep 2025 14:34:43 +0200 Subject: [PATCH] InputText: Word-Wrap: avoid word-wrap specific path InputTextLineIndexGetPosOffset() when word-wrap is disabled. (#3237, #952, #1062, #7363) --- imgui_widgets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index c5359044e..5ba4293a7 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4594,7 +4594,7 @@ static ImVec2 InputTextLineIndexGetPosOffset(ImGuiContext& g, ImGuiInputTextStat int* it_end = line_index->Offsets.end(); const int* it = ImLowerBound(it_begin, it_end, cursor_n); if (it > it_begin) - if (it == it_end || *it != cursor_n || (cursor_ptr[-1] != '\n' && cursor_ptr[-1] != 0 && state != NULL && state->LastMoveDirectionLR == ImGuiDir_Right)) + if (it == it_end || *it != cursor_n || (state->WrapWidth > 0.0f && cursor_ptr[-1] != '\n' && cursor_ptr[-1] != 0 && state != NULL && state->LastMoveDirectionLR == ImGuiDir_Right)) it--; const int line_no = (it == it_begin) ? 0 : line_index->Offsets.index_from_ptr(it);