diff --git a/engine/src/flutter/shell/platform/windows/text_input_plugin.cc b/engine/src/flutter/shell/platform/windows/text_input_plugin.cc index 8e2badaf773..0e8b12fb697 100644 --- a/engine/src/flutter/shell/platform/windows/text_input_plugin.cc +++ b/engine/src/flutter/shell/platform/windows/text_input_plugin.cc @@ -446,8 +446,16 @@ void TextInputPlugin::SendStateUpdateWithDelta(const TextInputModel& model, void TextInputPlugin::EnterPressed(TextInputModel* model) { if (input_type_ == kMultilineInputType) { - model->AddText(std::u16string({u'\n'})); - SendStateUpdate(*model); + std::u16string text_before_change = fml::Utf8ToUtf16(model->GetText()); + TextRange selection_before_change = model->selection(); + model->AddText(u"\n"); + if (enable_delta_model) { + TextEditingDelta delta(text_before_change, selection_before_change, + u"\n"); + SendStateUpdateWithDelta(*model, &delta); + } else { + SendStateUpdate(*model); + } } auto args = std::make_unique(rapidjson::kArrayType); auto& allocator = args->GetAllocator();