1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-28 09:30:56 +01:00

InputText: intentionally ignore character input when ctrl/alt are held (not sure if correct) (#279)

This commit is contained in:
ocornut 2015-08-21 00:24:47 +02:00
parent 23ce837dc7
commit b28858b33b

View File

@ -7022,15 +7022,16 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
if (g.IO.InputCharacters[0]) if (g.IO.InputCharacters[0])
{ {
// Process text input (before we check for Return because using some IME will effectively send a Return?) // 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]) 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)) // Insert character if they pass filtering
continue; if (!InputTextFilterCharacter(&c, flags, callback, user_data))
edit_state.OnKeyPressed((int)c); continue;
} edit_state.OnKeyPressed((int)c);
}
} }
// Consume characters // Consume characters