From 9501cd999151822d8d8232cccded8e7280967296 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 13 Aug 2016 14:22:34 +0200 Subject: [PATCH] InputText: Fixed calling callback on frame of losing active id, fix part of 848e62bfe0fe6083668afebdfaa5ab234a4817d9 (nav branch only) #323 #701 --- imgui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index bf375ae9..e7a2a76a 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8695,7 +8695,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 } bool cancel_edit = false; - if (g.ActiveId == id && !g.ActiveIdIsJustActivated) + if (g.ActiveId == id && !g.ActiveIdIsJustActivated && !clear_active_id) { // Handle key-presses const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0); @@ -8806,7 +8806,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 value_changed = true; } } - else + if (!cancel_edit && !clear_active_id) { // Apply new value immediately - copy modified buffer back // Note that as soon as the input box is active, the in-widget value gets priority over any underlying modification of the input buffer