|
@@ -3815,7 +3815,7 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|
|
if (c < 0x20)
|
|
|
{
|
|
|
bool pass = false;
|
|
|
- pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline));
|
|
|
+ pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline)); // Note that an Enter KEY will emit \r and be ignored (we poll for KEY in InputText() code)
|
|
|
pass |= (c == '\t' && (flags & ImGuiInputTextFlags_AllowTabInput));
|
|
|
if (!pass)
|
|
|
return false;
|
|
@@ -4201,16 +4201,15 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
if (state->SelectedAllMouseLock && !io.MouseDown[0])
|
|
|
state->SelectedAllMouseLock = false;
|
|
|
|
|
|
- // It is ill-defined whether the backend needs to send a \t character when pressing the TAB keys.
|
|
|
- // Win32 and GLFW naturally do it but not SDL.
|
|
|
+ // We except backends to emit a Tab key but some also emit a Tab character which we ignore (#2467, #1336)
|
|
|
+ // (For Tab and Enter: Win32/SFML/Allegro are sending both keys and chars, GLFW and SDL are only sending keys. For Space they all send all threes)
|
|
|
const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper);
|
|
|
if ((flags & ImGuiInputTextFlags_AllowTabInput) && IsKeyPressed(ImGuiKey_Tab) && !ignore_char_inputs && !io.KeyShift && !is_readonly)
|
|
|
- if (!io.InputQueueCharacters.contains('\t'))
|
|
|
- {
|
|
|
- unsigned int c = '\t'; // Insert TAB
|
|
|
- if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
|
|
|
- state->OnKeyPressed((int)c);
|
|
|
- }
|
|
|
+ {
|
|
|
+ unsigned int c = '\t'; // Insert TAB
|
|
|
+ if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
|
|
|
+ state->OnKeyPressed((int)c);
|
|
|
+ }
|
|
|
|
|
|
// Process regular text input (before we check for Return because using some IME will effectively send a Return?)
|
|
|
// We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters.
|
|
@@ -4221,7 +4220,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
{
|
|
|
// Insert character if they pass filtering
|
|
|
unsigned int c = (unsigned int)io.InputQueueCharacters[n];
|
|
|
- if (c == '\t' && io.KeyShift)
|
|
|
+ if (c == '\t') // Skip Tab, see above.
|
|
|
continue;
|
|
|
if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
|
|
|
state->OnKeyPressed((int)c);
|