diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 642dbded5..2265df94d 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -43,6 +43,8 @@ Breaking Changes: Other Changes: +- DragXXX, SliderXXX: fixed a regression in 1.92.9 where clicking a previously + Ctrl+Clicked field would flick it to text edit mode for a frame. (#9476, #701) - Tables: - Fixed Y2 position of lower horizontal border (ImGuiTableFlags_BordersOuterH) being off by one pixel when vertical ones are not also enabled. [@thedmd] diff --git a/imgui_internal.h b/imgui_internal.h index 1a9369aa0..c7efaf44e 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1265,6 +1265,7 @@ struct IMGUI_API ImGuiInputTextState ImStbTexteditState* Stb; // State for stb_textedit.h ImGuiInputTextFlags Flags; // copy of InputText() flags. may be used to check if e.g. ImGuiInputTextFlags_Password is set. ImGuiID ID; // widget id owning the text state + //int LastFrameActive; // Last used frame-count (unused) int TextLen; // UTF-8 length of the string in TextA (in bytes) const char* TextSrc; // == TextA.Data unless read-only, in which case == buf passed to InputText(). For _ReadOnly fields, pointer will be null outside the InputText() call. ImVector TextA; // main UTF8 buffer. TextA.Size is a buffer size! Should always be >= buf_size passed by user (and of course >= CurLenA + 1). diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 6c324e7b0..3c46db524 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4606,6 +4606,7 @@ void ImGui::InputTextDeactivateHook(ImGuiID id) if (!state->EditedBefore) return; //IMGUI_DEBUG_LOG_ACTIVEID("InputTextDeactivateHook() id = 0x%08X\n", id); + state->EditedBefore = false; g.InputTextDeactivatedState.ID = state->ID; g.InputTextDeactivatedState.ElapseFrame = g.FrameCount + 1; if (state->Flags & ImGuiInputTextFlags_ReadOnly) @@ -4997,6 +4998,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (state != NULL && state->ID == id) { state->Flags = flags; + //state->LastFrameActive = g.FrameCount; // Word-wrapping: attempt to keep cursor in view while resizing frame/parent (FIXME-WORDWRAP: would be better to preserve same relative offset) if (is_wordwrap && state->WrapWidth != wrap_width) @@ -5484,9 +5486,8 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ // Otherwise request text input ahead for next frame. if (g.ActiveId == id && clear_active_id) { - state->ID = 0; // To avoid InputTextDeactivateHook() unnecessarily running, which wouldn't be harmful but wasteful. + state->EditedBefore = false; // Data already applied: avoid InputTextDeactivateHook() taking a record now or later if same id is activated again without editing. ClearActiveID(); - state->ID = id; } // Render frame