|
@@ -37,7 +37,7 @@ Index of this file:
|
|
|
#endif
|
|
|
#include "imgui_internal.h"
|
|
|
|
|
|
-#include <ctype.h> // toupper, isprint
|
|
|
+#include <ctype.h> // toupper
|
|
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
|
|
#include <stddef.h> // intptr_t
|
|
|
#else
|
|
@@ -3139,7 +3139,8 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|
|
{
|
|
|
unsigned int c = *p_char;
|
|
|
|
|
|
- if (c < 128 && c != ' ' && !isprint((int)(c & 0xFF)))
|
|
|
+ // Filter non-printable (NB: isprint is unreliable! see #2467)
|
|
|
+ if (c < 0x20)
|
|
|
{
|
|
|
bool pass = false;
|
|
|
pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline));
|
|
@@ -3148,9 +3149,11 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if (c >= 0xE000 && c <= 0xF8FF) // Filter private Unicode range. I don't imagine anybody would want to input them. GLFW on OSX seems to send private characters for special keys like arrow keys.
|
|
|
+ // Filter private Unicode range. GLFW on OSX seems to send private characters for special keys like arrow keys (FIXME)
|
|
|
+ if (c >= 0xE000 && c <= 0xF8FF)
|
|
|
return false;
|
|
|
|
|
|
+ // Generic named filters
|
|
|
if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsScientific))
|
|
|
{
|
|
|
if (flags & ImGuiInputTextFlags_CharsDecimal)
|
|
@@ -3174,6 +3177,7 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ // Custom callback filter
|
|
|
if (flags & ImGuiInputTextFlags_CallbackCharFilter)
|
|
|
{
|
|
|
ImGuiInputTextCallbackData callback_data;
|