InputText: fixed incorrect edit state after text buffer is modified by user through callback #206

This commit is contained in:
ocornut 2015-05-02 12:45:53 +01:00
parent 81bf614821
commit 1b5795c96d

View File

@ -6690,7 +6690,8 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
if (callback_data.SelectionEnd != utf8_selection_end) edit_state.StbState.select_end = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionEnd);
if (callback_data.BufDirty)
{
ImTextStrFromUtf8(edit_state.Text, IM_ARRAYSIZE(edit_state.Text), g.TempBuffer, NULL);
edit_state.CurLenW = ImTextStrFromUtf8(edit_state.Text, IM_ARRAYSIZE(edit_state.Text), g.TempBuffer, NULL);
edit_state.CurLenA = strlen(g.TempBuffer);
edit_state.CursorAnimReset();
}
}