mirror of
https://github.com/ocornut/imgui.git
synced 2025-12-23 06:38:58 +00:00
InputText, InputInt, InputFloat: fixed an issue where using Escape to revert would not write back the reverted value. (#8915, #8273)
Revealed by 00f12b9a0
Regression test: "widgets_inputtext_temp_buffer_2"
This commit is contained in:
@@ -5058,14 +5058,14 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
if (flags & ImGuiInputTextFlags_EscapeClearsAll)
|
||||
{
|
||||
// Clear input
|
||||
IM_ASSERT(buf[0] != 0);
|
||||
IM_ASSERT(buf[0] != 0); // FIXME: use TextA here?
|
||||
apply_new_text = "";
|
||||
apply_new_text_length = 0;
|
||||
value_changed = true;
|
||||
IMSTB_TEXTEDIT_CHARTYPE empty_string;
|
||||
stb_textedit_replace(state, state->Stb, &empty_string, 0);
|
||||
}
|
||||
else if (strcmp(buf, state->TextToRevertTo.Data) != 0)
|
||||
else if (strcmp(state->TextA.Data, state->TextToRevertTo.Data) != 0)
|
||||
{
|
||||
apply_new_text = state->TextToRevertTo.Data;
|
||||
apply_new_text_length = state->TextToRevertTo.Size - 1;
|
||||
|
||||
Reference in New Issue
Block a user