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

@ -54,6 +54,7 @@ Other changes:
- MultiSelect+TreeNode: default open behavior is OpenOnDoubleClick + OpenOnArrow
when used in a multi-select context without any OpenOnXXX flags set. (#7850)
- InputText: allow callback to update buffer while in read-only mode. (imgui_club/#46)
- InputText: fixed an issue programmatically refocusing a multi-line input which was just active. (#4761, #7870)
- TextLink(), TextLinkOpenURL(): change mouse cursor to Hand shape when hovered. (#7885, #7660)
- Fonts: Made it possible to use PushFont()/PopFont() calls accross Begin() calls. (#3224, #3875, #6398, #7903)
- Backends: GLFW: added ImGui_ImplGlfw_Sleep() helper function because GLFW does not

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;