1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

InputText: fixed an issue programmatically refocusing a multi-line input which was just active. (#4761, #7870)

Amend 66f0fb986, c5db276521
This commit is contained in:
ocornut 2024-08-21 14:26:53 +02:00
parent 8a946b69e9
commit 521f84a3a9
2 changed files with 3 additions and 2 deletions

View file

@ -5194,7 +5194,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
if (is_multiline)
{
// For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags_Inputable (ref issue #4761)...
// For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags_Inputable (see #4761, #7870)...
Dummy(ImVec2(text_size.x, text_size.y + style.FramePadding.y));
g.NextItemData.ItemFlags |= ImGuiItemFlags_Inputable | ImGuiItemFlags_NoTabStop;
EndChild();
@ -5203,7 +5203,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
// ...and then we need to undo the group overriding last item data, which gets a bit messy as EndGroup() tries to forward scrollbar being active...
// FIXME: This quite messy/tricky, should attempt to get rid of the child window.
EndGroup();
if (g.LastItemData.ID == 0)
if (g.LastItemData.ID == 0 || g.LastItemData.ID != GetWindowScrollbarID(draw_window, ImGuiAxis_Y))
{
g.LastItemData.ID = id;
g.LastItemData.InFlags = item_data_backup.InFlags;