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)

This commit is contained in:
ocornut
2026-07-31 13:09:40 +02:00
parent b9adace7b5
commit 448ef2baa9
3 changed files with 6 additions and 2 deletions

View File

@@ -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]

View File

@@ -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<char> TextA; // main UTF8 buffer. TextA.Size is a buffer size! Should always be >= buf_size passed by user (and of course >= CurLenA + 1).

View File

@@ -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