From b28858b33b912bc636f580a4ec8010c2df5192f1 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 21 Aug 2015 00:24:47 +0200 Subject: [PATCH] InputText: intentionally ignore character input when ctrl/alt are held (not sure if correct) (#279) --- imgui.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index ff23df2f0..59c96e8c4 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7022,15 +7022,16 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 if (g.IO.InputCharacters[0]) { // Process text input (before we check for Return because using some IME will effectively send a Return?) - for (int n = 0; n < IM_ARRAYSIZE(g.IO.InputCharacters) && g.IO.InputCharacters[n]; n++) + if (!is_ctrl_down && !is_alt_down) { - if (unsigned int c = (unsigned int)g.IO.InputCharacters[n]) - { - // Insert character if they pass filtering - if (!InputTextFilterCharacter(&c, flags, callback, user_data)) - continue; - edit_state.OnKeyPressed((int)c); - } + for (int n = 0; n < IM_ARRAYSIZE(g.IO.InputCharacters) && g.IO.InputCharacters[n]; n++) + if (unsigned int c = (unsigned int)g.IO.InputCharacters[n]) + { + // Insert character if they pass filtering + if (!InputTextFilterCharacter(&c, flags, callback, user_data)) + continue; + edit_state.OnKeyPressed((int)c); + } } // Consume characters