mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-25 13:07:01 +00:00
InputText: Fixed a one-frame display glitch where pressing Escape to revert after a deletion would lead to small garbage being displayed for one frame. (#3008)
Curiously very old, amend83efdce
andbdbb2b2
. Using stb_ functions updated ->CurLenA without updating ->TextA, leading to `buf_display_end = buf_display + state->CurLenA;` in the display. Sincef3ab5e62
they are 1 case out of 4 which didn't apply back to ->TextA and this is essentially the one where we ensure appliance. Another solution would be to alter the lower display code, but applying to TextA makes things more consistent.
This commit is contained in:
parent
5139fb7e18
commit
697ce2d67b
@ -83,6 +83,8 @@ Other Changes:
|
||||
return value is overriden by focus when gamepad/keyboard navigation is active.
|
||||
- InputText: Fixed pressing Tab emitting two tabs characters because of dual Keys/Chars events being
|
||||
trickled with the new input queue (happened on some backends only). (#2467, #1336)
|
||||
- InputText: Fixed a one-frame display glitch where pressing Escape to revert after a deletion
|
||||
would lead to small garbage being displayed for one frame. Curiously a rather old bug! (#3008)
|
||||
- Tables: Fixed incorrect border height used for logic when resizing one of several synchronized
|
||||
instance of a same table ID, when instances have a different height. (#3955).
|
||||
- Tables: Fixed incorrect auto-fit of parent windows when using non-resizable weighted columns. (#5276)
|
||||
|
2
imgui.h
2
imgui.h
@ -65,7 +65,7 @@ Index of this file:
|
||||
// Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||
#define IMGUI_VERSION "1.88 WIP"
|
||||
#define IMGUI_VERSION_NUM 18723
|
||||
#define IMGUI_VERSION_NUM 18724
|
||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
|
@ -4425,22 +4425,24 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
}
|
||||
}
|
||||
|
||||
// Apply ASCII value
|
||||
if (!is_readonly)
|
||||
{
|
||||
state->TextAIsValid = true;
|
||||
state->TextA.resize(state->TextW.Size * 4 + 1);
|
||||
ImTextStrToUtf8(state->TextA.Data, state->TextA.Size, state->TextW.Data, NULL);
|
||||
}
|
||||
|
||||
// When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame.
|
||||
// If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail.
|
||||
// This also allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage (please note that if you use this property along ImGuiInputTextFlags_CallbackResize you can end up with your temporary string object unnecessarily allocating once a frame, either store your string data, either if you don't then don't use ImGuiInputTextFlags_CallbackResize).
|
||||
bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);
|
||||
const bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);
|
||||
if (apply_edit_back_to_user_buffer)
|
||||
{
|
||||
// Apply new value immediately - copy modified buffer back
|
||||
// Note that as soon as the input box is active, the in-widget value gets priority over any underlying modification of the input buffer
|
||||
// FIXME: We actually always render 'buf' when calling DrawList->AddText, making the comment above incorrect.
|
||||
// FIXME-OPT: CPU waste to do this every time the widget is active, should mark dirty state from the stb_textedit callbacks.
|
||||
if (!is_readonly)
|
||||
{
|
||||
state->TextAIsValid = true;
|
||||
state->TextA.resize(state->TextW.Size * 4 + 1);
|
||||
ImTextStrToUtf8(state->TextA.Data, state->TextA.Size, state->TextW.Data, NULL);
|
||||
}
|
||||
|
||||
// User callback
|
||||
if ((flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory | ImGuiInputTextFlags_CallbackEdit | ImGuiInputTextFlags_CallbackAlways)) != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user