InputText: Fixed returning true when edition is cancelled with Esc and the current buffer matches the initial value.

This commit is contained in:
omar
2018-04-27 17:19:49 +02:00
parent 28edece04f
commit 101f9b42b7
2 changed files with 3 additions and 2 deletions

View File

@ -10245,8 +10245,8 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
{
if (cancel_edit)
{
// Restore initial value
if (is_editable)
// Restore initial value. Only return true if restoring to the initial value changes the current buffer contents.
if (is_editable && strncmp(buf, edit_state.InitialText.Data, buf_size) != 0)
{
ImStrncpy(buf, edit_state.InitialText.Data, buf_size);
value_changed = true;