mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix entering newline on deltas for windows (flutter/engine#32195)
* Fix entering newline * utf8toutf16 * formatting * Address reviews * send *model“ * capture oldtext and selection before newline is added to model * use model vs _active_model_ for consistency * Formatting * updates Co-authored-by: Renzo Olivares <roliv@google.com>
This commit is contained in:
parent
2c9315d92a
commit
47fcfe0b21
@ -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::Document>(rapidjson::kArrayType);
|
||||
auto& allocator = args->GetAllocator();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user