From 0608887fb5783999b6682c290d15db8d59e1001c Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 23 Aug 2021 17:07:46 +0200 Subject: [PATCH] InputTextMultiline: Fixed label size not being included into window contents rect unless the whole widget is clipped. --- docs/CHANGELOG.txt | 2 ++ imgui_widgets.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 98df209a7..4797b91dc 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -42,6 +42,8 @@ Breaking Changes: Other Changes: +- InputTextMultiline: Fixed label size not being included into window contents rect unless + the whole widget is clipped. - imgui_freetype: Fixed crash when FT_Render_Glyph() fails to render a glyph and returns NULL (which apparently happens with Freetype 2.11). (#4394, #4145?). diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 95aa3141f..2a760ce92 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -3969,13 +3969,15 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ ImGuiItemStatusFlags item_status_flags = 0; if (is_multiline) { + ImVec2 backup_pos = window->DC.CursorPos; + ItemSize(total_bb, style.FramePadding.y); if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemAddFlags_Focusable)) { - ItemSize(total_bb, style.FramePadding.y); EndGroup(); return false; } item_status_flags = g.LastItemData.StatusFlags; + window->DC.CursorPos = backup_pos; // We reproduce the contents of BeginChildFrame() in order to provide 'label' so our window internal data are easier to read/debug. PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);