From 6982ce43f5b143c5dce5fab0ce07dd4867b705ae Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 22 Dec 2024 17:53:09 +0100 Subject: [PATCH] InputText: fixed badly broken clipboard copy/bug (#8254, #8242) Broken by 32f1140 --- imgui_widgets.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 0fef03ab5a8d..e19974f665b4 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4900,8 +4900,8 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ const int ib = state->HasSelection() ? ImMin(state->Stb->select_start, state->Stb->select_end) : 0; const int ie = state->HasSelection() ? ImMax(state->Stb->select_start, state->Stb->select_end) : state->TextLen; g.TempBuffer.reserve(ie - ib + 1); - memcpy(g.TempBuffer.Data, state->TextSrc, ie - ib); - g.TempBuffer.Data[ie] = 0; + memcpy(g.TempBuffer.Data, state->TextSrc + ib, ie - ib); + g.TempBuffer.Data[ie - ib] = 0; SetClipboardText(g.TempBuffer.Data); } if (is_cut)