InputTextMultiline: Fixed label size not being included into window contents rect unless the whole widget is clipped.

This commit is contained in:
ocornut 2021-08-23 17:07:46 +02:00
parent 68f428b449
commit 0608887fb5
2 changed files with 5 additions and 1 deletions

View File

@ -42,6 +42,8 @@ Breaking Changes:
Other 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 - 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?). (which apparently happens with Freetype 2.11). (#4394, #4145?).

View File

@ -3969,13 +3969,15 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
ImGuiItemStatusFlags item_status_flags = 0; ImGuiItemStatusFlags item_status_flags = 0;
if (is_multiline) if (is_multiline)
{ {
ImVec2 backup_pos = window->DC.CursorPos;
ItemSize(total_bb, style.FramePadding.y);
if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemAddFlags_Focusable)) if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemAddFlags_Focusable))
{ {
ItemSize(total_bb, style.FramePadding.y);
EndGroup(); EndGroup();
return false; return false;
} }
item_status_flags = g.LastItemData.StatusFlags; 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. // 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]); PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);