You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
InputText: Fixed a tricky edge case, ensuring value is always written back on the frame where IsItemDeactivated() returns true (#4714)
Altered ItemAdd() clipping rule to keep previous-frame ActiveId unclipped to support that late commit.
Also, MarkItemEdited() may in theory need to do:
if (g.ActiveIdPreviousFrame == id)
g.ActiveIdPreviousFrameHasBeenEditedBefore = true;
But this should already be set so not adding now.
// This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit().
3841
3852
// ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need to fill the data.
3842
3853
ImGuiContext& g = *GImGui;
3843
-
IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive);
3844
-
IM_UNUSED(id); // Avoid unused variable warnings when asserts are compiled out.
3854
+
if (g.ActiveId == id || g.ActiveId == 0)
3855
+
{
3856
+
g.ActiveIdHasBeenEditedThisFrame = true;
3857
+
g.ActiveIdHasBeenEditedBefore = true;
3858
+
}
3859
+
3860
+
// We accept a MarkItemEdited() on drag and drop targets (see https://github.com/ocornut/imgui/issues/1875#issuecomment-978243343)
3861
+
// We accept 'ActiveIdPreviousFrame == id' for InputText() returning an edit after it has been taken ActiveId away (#4714)
// Backup state of deactivating item so they'll have a chance to do a write to output buffer on the same frame they report IsItemDeactivatedAfterEdit (#4714)
4132
+
InputTextDeactivateHook(state->ID);
4133
+
4116
4134
// Take a copy of the initial buffer value (both in original UTF-8 format and converted to wchar)
4117
4135
// From the moment we focused we are ignoring the content of 'buf' (unless we are in read-only mode)
0 commit comments