Skip to content

[Windows] Preserve composing extent in setEditingState - #189968

Merged
auto-submit[bot] merged 5 commits into
flutter:masterfrom
tjcGoogle:codex/fix-windows-composing-extent
Oct 2, 2026
Merged

auto-submit[bot] merged 5 commits into
flutter:masterfrom
tjcGoogle:codex/fix-windows-composing-extent

Conversation

@tjcGoogle

@tjcGoogle tjcGoogle commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes a field-read typo in the Windows implementation of TextInput.setEditingState. The composing extent was read from composingBase, which collapsed every non-collapsed composing range before passing it to TextInputModel.

This change reads the extent from composingExtent and adds a regression test that sends a composing range of [1, 3] and verifies that the range is preserved.

No issue is linked because this is a trivial field-read typo.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the AI contribution guidelines and understand my responsibilities, or I am not using AI tools.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///). No documentation changes are needed for this field-read fix.
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • I followed the breaking change policy and added Data Driven Fixes where supported. This is not a breaking change and does not require a data-driven fix.
  • All existing and new tests are passing. The Windows-only test target could not be run on the macOS development host; Flutter CI will verify it.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@tjcGoogle
tjcGoogle requested a review from a team as a code owner July 24, 2026 05:38
@google-cla

google-cla Bot commented Jul 24, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems engine flutter/engine related. See also e: labels. platform-windows Building on or for Windows specifically a: desktop Running on desktop team-windows Owned by the Windows platform team labels Jul 24, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request fixes a bug in TextInputPlugin where composing_extent was incorrectly assigned the value of base instead of extent, and adds a unit test to verify that the composing range is preserved. The review feedback suggests omitting unused parameter names in the test's lambda functions to prevent potential compiler warnings and improve readability.

Comment thread engine/src/flutter/shell/platform/windows/text_input_plugin_unittest.cc Outdated
@tjcGoogle
tjcGoogle force-pushed the codex/fix-windows-composing-extent branch from 5264a14 to a5816e7 Compare July 24, 2026 05:55
@loic-sharma loic-sharma added the CICD Run CI/CD label Jul 29, 2026
loic-sharma
loic-sharma previously approved these changes Jul 29, 2026

@loic-sharma loic-sharma left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix!

@loic-sharma

Copy link
Copy Markdown
Member

@Renzo-Olivares Would you mind being the second reviewer for this change? Matt from Canonical - who normally reviews Windows changes - is out on vacation for the next two weeks. Thanks in advance! :)

@Renzo-Olivares
Renzo-Olivares self-requested a review July 30, 2026 20:37
@loic-sharma

Copy link
Copy Markdown
Member

@tjcGoogle It looks like the test is failing in CI: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8674821850985549569/+/u/test:_Host_Tests_for_host_debug_test/stdout

[----------] 1 test from TextInputPluginTest
[ RUN      ] TextInputPluginTest.SetEditingStatePreservesComposingRange
../../../flutter/shell/platform/windows/text_input_plugin_unittest.cc(543): error: Value of: modifier.GetActiveModel()->composing()
  Actual: false
Expected: true

../../../flutter/shell/platform/windows/text_input_plugin_unittest.cc(544): error: Expected equality of these values:
  modifier.GetActiveModel()->composing_range()
    Which is: 24-byte object <98-DC BB-57 F7-7F 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00>
  TextRange(1, 3)
    Which is: 24-byte object <98-DC BB-57 F7-7F 00-00 01-00 00-00 00-00 00-00 03-00 00-00 00-00 00-00>

[  FAILED  ] TextInputPluginTest.SetEditingStatePreservesComposingRange (14 ms)
[----------] 1 test from TextInputPluginTest (14 ms total)

@tjcGoogle

Copy link
Copy Markdown
Contributor Author

Follow-up fix for the failing host test: the typo fix alone could not preserve the composing range.

In setEditingState, the handler first calls the single-argument SetText(text), which resets the model composing state (composing_ = !composing_range.collapsed() with a collapsed default TextRange(0)). The subsequent SetComposingRange call then always bails out on its !composing_ guard, so the composing range sent by the framework was silently dropped (model ends with composing() == false, range (0,0) — exactly what the CI failure shows).

This commit applies the text, selection, and composing range in one SetText call (the API text_input_model.h documents for framework editing-state sync), and translates a -1/-1 composing range to 0/0 to match the existing selection handling, which is equivalent to the previous EndComposing() path.

I verified the failure and the fix locally by driving the real TextInputModel through the same call sequence: the old sequence leaves composing()==false / range (0,0), the new sequence preserves [1,3]. Reverting the extent read (back to base) in the new flow makes the regression test fail again on composing(), so the test still guards the original typo. Windows CI will confirm on the real target.

Comment thread engine/src/flutter/shell/platform/windows/text_input_plugin.cc Outdated
@loic-sharma loic-sharma added the CICD Run CI/CD label Aug 3, 2026
Renzo-Olivares
Renzo-Olivares previously approved these changes Aug 3, 2026

@Renzo-Olivares Renzo-Olivares left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM modulo @loic-sharma comment.

@justinmc justinmc added the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 13, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Aug 19, 2026
@loic-sharma loic-sharma added CICD Run CI/CD and removed waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds labels Aug 19, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Aug 19, 2026
@loic-sharma loic-sharma added the CICD Run CI/CD label Aug 19, 2026
@Renzo-Olivares

Copy link
Copy Markdown
Contributor

Looks like et format has to be run to fix formatting errors in text_input_plugin_unittest.cc.

@Renzo-Olivares
Renzo-Olivares force-pushed the codex/fix-windows-composing-extent branch from 106339d to 1d2fe49 Compare September 1, 2026 21:07
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 1, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 23, 2026
@loic-sharma loic-sharma added the CICD Run CI/CD label Sep 23, 2026

@loic-sharma loic-sharma left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-LGTM

@Renzo-Olivares
Renzo-Olivares force-pushed the codex/fix-windows-composing-extent branch from a33d238 to d61453b Compare September 24, 2026 19:55
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 24, 2026
@Renzo-Olivares Renzo-Olivares added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Sep 24, 2026
@auto-submit

auto-submit Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/189968, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 24, 2026
@Renzo-Olivares
Renzo-Olivares force-pushed the codex/fix-windows-composing-extent branch from d61453b to 990a00f Compare September 25, 2026 03:26
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 25, 2026
@loic-sharma loic-sharma added the CICD Run CI/CD label Sep 25, 2026
tjcGoogle and others added 5 commits October 1, 2026 13:31
The single-argument SetText call resets the model's composing state,
so the subsequent SetComposingRange always failed and the composing
range sent by the framework was silently dropped. Apply the text,
selection, and composing range in one SetText call, which is the API
intended for framework editing-state synchronization.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@Renzo-Olivares
Renzo-Olivares force-pushed the codex/fix-windows-composing-extent branch from 990a00f to ff1d255 Compare October 1, 2026 20:31
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Oct 1, 2026
@Renzo-Olivares Renzo-Olivares added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Oct 1, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 2, 2026
Merged via the queue into flutter:master with commit e5077f5 Oct 2, 2026
27 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 2, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 2, 2026
flutter/flutter@e89fd0a...d03768e

2026-10-02 [email protected] Roll Skia from 7b7326917e77 to 9e88bf828078 (8 revisions) (flutter/flutter#193694)
2026-10-02 [email protected] [Widget Preview] Provide descriptive error when widget preview is unconstrained (flutter/flutter#193005)
2026-10-02 [email protected] Roll Dart SDK from 0e7642b85457 to ac1a97aae47d (26 revisions) (flutter/flutter#193692)
2026-10-02 [email protected] Remove unused Fuchsia sysmem header files (flutter/flutter#193244)
2026-10-02 [email protected] [Windows] Preserve composing extent in setEditingState (flutter/flutter#189968)
2026-10-02 [email protected] [docs] Make Border.symmetric docs more explicit about their arguments (flutter/flutter#193222)
2026-10-02 [email protected] [Embedder] Support render texture for vulkan (flutter/flutter#188855)
2026-10-02 [email protected] Updated Remaining Engine Defaults to SDK 37 (flutter/flutter#190429)
2026-10-02 [email protected] Document that enableSuggestions: false can disable keyboard languages on Android (flutter/flutter#192714)
2026-10-02 [email protected] [flutter_tools] Explicitly track host CPU architecture in command result analytics (flutter/flutter#191836)
2026-10-02 [email protected] [web] Preserve DOM focus on role update and honor isAccessibilityFocusBlocked (flutter/flutter#192963)
2026-10-02 [email protected] [flutter_tools] Include base href in web hot reload script paths (flutter/flutter#193678)
2026-10-02 [email protected] [Impeller] Deduplicate GLES render pass state (flutter/flutter#193427)
2026-10-02 [email protected] Roll Skia from f2d68e0b8863 to 7b7326917e77 (16 revisions) (flutter/flutter#193676)
2026-10-01 [email protected] Fix analysis failures due to missing `const` (flutter/flutter#193685)
2026-10-01 [email protected] Removes a11y_assessment app (flutter/flutter#193671)
2026-10-01 [email protected] test: configure Xvfb and openbox for windowing_test (flutter/flutter#193529)
2026-10-01 [email protected] Sync CHANGELOG.md from stable (flutter/flutter#193666)
2026-10-01 [email protected] Avoid using relative path in Process.start (flutter/flutter#193664)
2026-10-01 [email protected] [AGP 9.1.0 Migration #6] Deliver Flutter assets as a generated assets source directory on the app path (flutter/flutter#192488)
2026-10-01 [email protected] ci(bringup): android_java17_build_android_host_app_with_module_aar is green (flutter/flutter#193580)
2026-10-01 [email protected] [flutter_tools] Fix Use dependency graph to determine plugin initialization order (flutter/flutter#191591)
2026-10-01 [email protected] [flutter_tools] Migrate DaemonCommand and Daemon domains to constructor DI (flutter/flutter#193542)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-windows Building on or for Windows specifically team-windows Owned by the Windows platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants