mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-01 02:37:24 +01:00
InputText: Work-around for buggy standard libraries where isprint('\t') returns true. (#2467, #1336)
Not using isprint. + todo items.
This commit is contained in:
parent
e3cd6b1cbb
commit
4a57507f75
@ -38,6 +38,7 @@ Breaking Changes:
|
|||||||
Other Changes:
|
Other Changes:
|
||||||
- InputText: Fixed selection background starts rendering one frame after the cursor movement
|
- InputText: Fixed selection background starts rendering one frame after the cursor movement
|
||||||
when first transitioning from no-selection to has-selection. (Bug in 1.69) (#2436) [@Nazg-Gul]
|
when first transitioning from no-selection to has-selection. (Bug in 1.69) (#2436) [@Nazg-Gul]
|
||||||
|
- InputText: Work-around for buggy standard libraries where isprint('\t') returns true. (#2467, #1336)
|
||||||
- GetMouseDragDelta(): also returns the delta on the mouse button released frame. (#2419)
|
- GetMouseDragDelta(): also returns the delta on the mouse button released frame. (#2419)
|
||||||
- GetMouseDragDelta(): verify that mouse positions are valid otherwise returns zero.
|
- GetMouseDragDelta(): verify that mouse positions are valid otherwise returns zero.
|
||||||
- Inputs: Also add support for horizontal scroll with Shift+Mouse Wheel. (#2424, #1463) [@LucaRood]
|
- Inputs: Also add support for horizontal scroll with Shift+Mouse Wheel. (#2424, #1463) [@LucaRood]
|
||||||
|
@ -138,7 +138,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- button: provide a button that looks framed. (?)
|
- button: provide a button that looks framed. (?)
|
||||||
- image/image button: misalignment on padded/bordered button?
|
- image/image button: misalignment on padded/bordered button?
|
||||||
- image/image button: parameters are confusing, image() has tint_col,border_col whereas imagebutton() has bg_col/tint_col. Even thou they are different parameters ordering could be more consistent. can we fix that?
|
- image/image button: parameters are confusing, image() has tint_col,border_col whereas imagebutton() has bg_col/tint_col. Even thou they are different parameters ordering could be more consistent. can we fix that?
|
||||||
- image button: not taking an explicit id is odd.
|
- image button: not taking an explicit id can be problematic. (#2464, #1390)
|
||||||
- slider/drag: ctrl+click when format doesn't include a % character.. disable? display underlying value in default format? (see InputScalarAsWidgetReplacement)
|
- slider/drag: ctrl+click when format doesn't include a % character.. disable? display underlying value in default format? (see InputScalarAsWidgetReplacement)
|
||||||
- slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt()
|
- slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt()
|
||||||
- slider: initial absolute click is imprecise. change to relative movement slider (same as scrollbar). (#1946)
|
- slider: initial absolute click is imprecise. change to relative movement slider (same as scrollbar). (#1946)
|
||||||
@ -329,6 +329,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- examples: glfw: could go idle when minimized? if (glfwGetWindowAttrib(window, GLFW_ICONIFIED)) { glfwWaitEvents(); continue; } // issue: DeltaTime will be super high on resume, perhaps provide a way to let impl know (#440)
|
- examples: glfw: could go idle when minimized? if (glfwGetWindowAttrib(window, GLFW_ICONIFIED)) { glfwWaitEvents(); continue; } // issue: DeltaTime will be super high on resume, perhaps provide a way to let impl know (#440)
|
||||||
- examples: opengl: rename imgui_impl_opengl2 to impl_opengl_legacy and imgui_impl_opengl3 to imgui_impl_opengl? (#1900)
|
- examples: opengl: rename imgui_impl_opengl2 to impl_opengl_legacy and imgui_impl_opengl3 to imgui_impl_opengl? (#1900)
|
||||||
- examples: opengl: could use a single vertex buffer and glBufferSubData for uploads?
|
- examples: opengl: could use a single vertex buffer and glBufferSubData for uploads?
|
||||||
|
- examples: vulkan: viewport: support for synchronized swapping of multiple swap chains.
|
||||||
- optimization: replace vsnprintf with stb_printf? or enable the defines/infrastructure to allow it (#1038)
|
- optimization: replace vsnprintf with stb_printf? or enable the defines/infrastructure to allow it (#1038)
|
||||||
- optimization: add clipping for multi-component widgets (SliderFloatX, ColorEditX, etc.). one problem is that nav branch can't easily clip parent group when there is a move request.
|
- optimization: add clipping for multi-component widgets (SliderFloatX, ColorEditX, etc.). one problem is that nav branch can't easily clip parent group when there is a move request.
|
||||||
- optimization: add a flag to disable most of rendering, for the case where the user expect to skip it (#335)
|
- optimization: add a flag to disable most of rendering, for the case where the user expect to skip it (#335)
|
||||||
|
@ -933,7 +933,7 @@ CODE
|
|||||||
#endif
|
#endif
|
||||||
#include "imgui_internal.h"
|
#include "imgui_internal.h"
|
||||||
|
|
||||||
#include <ctype.h> // toupper, isprint
|
#include <ctype.h> // toupper
|
||||||
#include <stdio.h> // vsnprintf, sscanf, printf
|
#include <stdio.h> // vsnprintf, sscanf, printf
|
||||||
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
||||||
#include <stddef.h> // intptr_t
|
#include <stddef.h> // intptr_t
|
||||||
|
@ -49,7 +49,7 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include <ctype.h> // toupper, isprint
|
#include <ctype.h> // toupper
|
||||||
#include <limits.h> // INT_MIN, INT_MAX
|
#include <limits.h> // INT_MIN, INT_MAX
|
||||||
#include <math.h> // sqrtf, powf, cosf, sinf, floorf, ceilf
|
#include <math.h> // sqrtf, powf, cosf, sinf, floorf, ceilf
|
||||||
#include <stdio.h> // vsnprintf, sscanf, printf
|
#include <stdio.h> // vsnprintf, sscanf, printf
|
||||||
@ -2571,6 +2571,7 @@ static void ShowDemoWindowMisc()
|
|||||||
ImGui::Text("Keys pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X)", i, i); }
|
ImGui::Text("Keys pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X)", i, i); }
|
||||||
ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X)", i, i); }
|
ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X)", i, i); }
|
||||||
ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
||||||
|
ImGui::Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine(); ImGui::Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public.
|
||||||
|
|
||||||
ImGui::Text("NavInputs down:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputs[i] > 0.0f) { ImGui::SameLine(); ImGui::Text("[%d] %.2f", i, io.NavInputs[i]); }
|
ImGui::Text("NavInputs down:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputs[i] > 0.0f) { ImGui::SameLine(); ImGui::Text("[%d] %.2f", i, io.NavInputs[i]); }
|
||||||
ImGui::Text("NavInputs pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputsDownDuration[i] == 0.0f) { ImGui::SameLine(); ImGui::Text("[%d]", i); }
|
ImGui::Text("NavInputs pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputsDownDuration[i] == 0.0f) { ImGui::SameLine(); ImGui::Text("[%d]", i); }
|
||||||
|
@ -37,7 +37,7 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
#include "imgui_internal.h"
|
#include "imgui_internal.h"
|
||||||
|
|
||||||
#include <ctype.h> // toupper, isprint
|
#include <ctype.h> // toupper
|
||||||
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
||||||
#include <stddef.h> // intptr_t
|
#include <stddef.h> // intptr_t
|
||||||
#else
|
#else
|
||||||
@ -3139,7 +3139,8 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|||||||
{
|
{
|
||||||
unsigned int c = *p_char;
|
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;
|
bool pass = false;
|
||||||
pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline));
|
pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline));
|
||||||
@ -3148,9 +3149,11 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|||||||
return false;
|
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;
|
return false;
|
||||||
|
|
||||||
|
// Generic named filters
|
||||||
if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsScientific))
|
if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsScientific))
|
||||||
{
|
{
|
||||||
if (flags & ImGuiInputTextFlags_CharsDecimal)
|
if (flags & ImGuiInputTextFlags_CharsDecimal)
|
||||||
@ -3174,6 +3177,7 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom callback filter
|
||||||
if (flags & ImGuiInputTextFlags_CallbackCharFilter)
|
if (flags & ImGuiInputTextFlags_CallbackCharFilter)
|
||||||
{
|
{
|
||||||
ImGuiInputTextCallbackData callback_data;
|
ImGuiInputTextCallbackData callback_data;
|
||||||
|
Loading…
Reference in New Issue
Block a user