Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

TextEditingDelta Windows#30329

Merged
justinmc merged 17 commits intoflutter:mainfrom
justinmc:deltas-windows
Mar 4, 2022
Merged

TextEditingDelta Windows#30329
justinmc merged 17 commits intoflutter:mainfrom
justinmc:deltas-windows

Conversation

@justinmc
Copy link
Contributor

This PR will bring TextEditingDeltas to Windows. See flutter/flutter#87972 (comment) for the status of all platforms.

Partial fix for flutter/flutter#87972

handler.ComposeChangeHook(textChineseCharacter, 1);
handler.ComposeCommitHook();
handler.ComposeEndHook();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if I could verify the deltas that are generated here, but I wasn't able to do it by mocking TextInputClient, and I also couldn't figure out if it's possible to listen to the message sent to the framework by SendStateUpdateWithDeltas. If anyone knows of a way, let me know.

}
}

void TextInputPlugin::ComposeChangeHook(const std::u16string& text,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Renzo-Olivares I tried out the composing stuff by typing Chinese into the delta-text-editor-demo. The demo seemed to be broken in how it handled replacements, as in when a composing region gets replaced by a final character or characters. I updated it so it worked for most cases, but sometimes it would end up inserting black text that should have been colored. We should figure out what to do with that demo before our versions diverge too much.

@justinmc justinmc marked this pull request as ready for review January 27, 2022 21:58
@justinmc justinmc requested a review from cbracken January 27, 2022 21:59
@justinmc
Copy link
Contributor Author

Any idea how I can debug the test failure? It's the test that I wrote, but it doesn't fail locally, even if I randomize it like on CI...

Assertion failed: enable_delta_model_json->value.IsBool()

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One quick suggestion on the API end of things.

}

void TextInputPlugin::SendStateUpdateWithDelta(const TextInputModel& model,
TextEditingDelta* delta) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we can pass this by const reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally got my Windows machine setup and was able to make this change and verify that it works 👍

@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

@justinmc justinmc requested a review from cbracken March 1, 2022 18:34
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with a couple nits.

TextRange composing_before_change = active_model_->composing_range();
std::string composing_text_before_change = text_before_change.substr(
composing_before_change.base(),
composing_before_change.extent() - composing_before_change.base());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use composing_before_change.start() and composing_before_change.length().

defines = [ "FLUTTER_ENGINE_NO_PROTOTYPES" ]
defines = [
"FLUTTER_ENGINE_NO_PROTOTYPES",
"_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these two plus the one below: I think you should be safe to remove these definitions now that all the encoding conversion stuff has moved to FML (I was able to remove it everywhere else).

@justinmc justinmc merged commit 4221213 into flutter:main Mar 4, 2022
@justinmc justinmc deleted the deltas-windows branch March 4, 2022 21:31
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants