Skip to content

Conversation

@hidea
Copy link
Contributor

@hidea hidea commented Mar 31, 2025

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. a: desktop Running on desktop platform-macos labels Mar 31, 2025
@hidea
Copy link
Contributor Author

hidea commented Apr 3, 2025

cc: @cbenhagen , @justinmc

@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #166291 at sha c0e00f8

@jmagman
Copy link
Member

jmagman commented Apr 14, 2025

@cbracken can you take a look?

@jmagman jmagman requested a review from cbracken April 14, 2025 16:38
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.

Thank you for your patch and apologies for missing this while I was out!

I think this is fine but I added a suggestion that might be a little cleaner. I'd like to know if you tried that approach, and if so, was it problematic?

// !range.collapsed()), selection == composing_range will failed. Therefore, the selection
// cursor should only be placed at the beginning of composing_range.
flutter::TextRange composing_range = _activeModel->composing_range();
_activeModel->SetSelection(flutter::TextRange(composing_range.start()));
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for spotting this. This feels like we're working around a bug in TextInputRange::AddText/TextInputRange::DeleteSelected.

I think when I wrote that code, I made the incorrect assumption that during composing, we'd only ever have a selection that matches the composing range.

I wonder if we should fix the logic there or at least add some assertions. If you look at what happens in the case where the selection is a subrange of the composing range, it deletes the selection and resets the composing range.

Instead it looks like what we should be doing is setting the selection to a collapsed selection at the start of the composing range. Here's the current implementation:

void TextInputModel::AddText(const std::u16string& text) {
  DeleteSelected();
  if (composing_) {
    // Delete the current composing text, set the cursor to composing start.
    text_.erase(composing_range_.start(), composing_range_.length());
    selection_ = TextRange(composing_range_.start());
    composing_range_.set_end(composing_range_.start() + text.length());
  }
  size_t position = selection_.position();
  text_.insert(position, text);
  selection_ = TextRange(position + text.length());
}

I wonder if we should change that to:

void TextInputModel::AddText(const std::u16string& text) {
  if (composing_) {
    // Delete the current composing text, set the cursor to composing start.
    text_.erase(composing_range_.start(), composing_range_.length());
    selection_ = TextRange(composing_range_.start());
    composing_range_.set_end(composing_range_.start() + text.length());
  } else {
    DeleteSelected();
  }
  size_t position = selection_.position();
  text_.insert(position, text);
  selection_ = TextRange(position + text.length());
}

I think the above is equivalent to your patch, but if we wanted to be a little more paranoid:

void TextInputModel::AddText(const std::u16string& text) {
  if (composing_ && composing_range_ != selection_) {
    selection_ = TextRange{composing_range_.start()};
  }
  DeleteSelected();
  if (composing_) {
    // Delete the current composing text, set the cursor to composing start.
    text_.erase(composing_range_.start(), composing_range_.length());
    selection_ = TextRange(composing_range_.start());
    composing_range_.set_end(composing_range_.start() + text.length());
  }
  size_t position = selection_.position();
  text_.insert(position, text);
  selection_ = TextRange(position + text.length());
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My RP was not comprehensive enough to grasp the overall structure, and I focused on ensuring the consistency of input/output for bugs that would prevent the app from being released when using Flutter.
If that can be achieved, I will leave the final revision method up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't TextInputModel::AddText, which was presented, common code for all platforms?
I believe that this issue is limited to macOS IME behavior.

@jmagman
Copy link
Member

jmagman commented May 15, 2025

@cbracken can you take another look at this?

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 stamp from a Japanese personal seal

Apologies for the delay -- this lgtm.

@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 2, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 2, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 2, 2025

autosubmit label was removed for flutter/flutter/166291, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a flutter-hacker before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@cbracken cbracken requested a review from loic-sharma June 6, 2025 21:53
@cbracken
Copy link
Member

cbracken commented Jun 6, 2025

@loic-sharma would you mind doing a secondary review?

@chinmaygarde
Copy link
Member

While we are waiting for @loic-sharma s review, can we also resolve the merge conflicts?

Copy link
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

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

LGTM

@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 11, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 11, 2025

autosubmit label was removed for flutter/flutter/166291, because Pull request flutter/flutter/166291 is not in a mergeable state.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 11, 2025
@chinmaygarde
Copy link
Member

The presubmit failures do look real.

@cbracken
Copy link
Member

I've fixed up the formatting issue locally and re-pushed.

@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 20, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jun 21, 2025
Merged via the queue into flutter:master with commit 453d113 Jun 21, 2025
174 of 175 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 21, 2025
@cbracken
Copy link
Member

@hidea Thanks for the fix! PRのマージが遅くなってすみませんでした。

@hidea
Copy link
Contributor Author

hidea commented Jun 21, 2025

@cbracken
Thank you very much for your review and merge.
I didn't know how to submit a PR, so it took me a while.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 22, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 22, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 22, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jun 23, 2025
flutter/flutter@c7362b4...0ab008a

2025-06-22 [email protected] Roll Skia from 203469ef4672 to fcd1c55da9cc (1 revision) (flutter/flutter#170986)
2025-06-22 [email protected] Roll Dart SDK from e5db5e0f81ba to 98db1db5ff65 (2 revisions) (flutter/flutter#170979)
2025-06-21 [email protected] Normalize input decoration theme (flutter/flutter#168981)
2025-06-21 [email protected] Roll Skia from dceb857b1c47 to 203469ef4672 (1 revision) (flutter/flutter#170959)
2025-06-21 [email protected] Roll Dart SDK from 6325aeacaef4 to e5db5e0f81ba (1 revision) (flutter/flutter#170958)
2025-06-21 [email protected] Roll Dart SDK from a6a3d65e33d7 to 6325aeacaef4 (2 revisions) (flutter/flutter#170955)
2025-06-21 [email protected] Roll Skia from 773188560221 to dceb857b1c47 (1 revision) (flutter/flutter#170954)
2025-06-21 [email protected] Roll Dart SDK from 750eaa028445 to a6a3d65e33d7 (1 revision) (flutter/flutter#170953)
2025-06-21 [email protected] Fix the Japanese IME problem on macOS reported in the following issue. (flutter/flutter#166291)
2025-06-21 [email protected] Roll Fuchsia Test Scripts from IfPORaYjQ2zP4bcq-... to 2wEtX_lDNhHhDNsP6... (flutter/flutter#170946)
2025-06-20 [email protected] Roll Skia from 104460420c48 to 773188560221 (2 revisions) (flutter/flutter#170942)
2025-06-20 [email protected] Normalize AppBarTheme (flutter/flutter#169130)
2025-06-20 [email protected] Close CupertinoContextMenu overlay if the widget is disposed or a new route is pushed (flutter/flutter#170186)
2025-06-20 [email protected] Roll Dart SDK from a554bdd0a2cc to 750eaa028445 (1 revision) (flutter/flutter#170933)
2025-06-20 [email protected] Roll Skia from b638003de37e to 104460420c48 (1 revision) (flutter/flutter#170932)
2025-06-20 [email protected] Roll Packages from 0ec4053 to 7f41e75 (1 revision) (flutter/flutter#170925)
2025-06-20 [email protected] Roll Skia from f1e68950ea7b to b638003de37e (5 revisions) (flutter/flutter#170923)
2025-06-20 [email protected] [licenses_cpp] jun17 (flutter/flutter#170845)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [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
Ortes pushed a commit to Ortes/packages that referenced this pull request Jun 25, 2025
…r#9472)

flutter/flutter@c7362b4...0ab008a

2025-06-22 [email protected] Roll Skia from 203469ef4672 to fcd1c55da9cc (1 revision) (flutter/flutter#170986)
2025-06-22 [email protected] Roll Dart SDK from e5db5e0f81ba to 98db1db5ff65 (2 revisions) (flutter/flutter#170979)
2025-06-21 [email protected] Normalize input decoration theme (flutter/flutter#168981)
2025-06-21 [email protected] Roll Skia from dceb857b1c47 to 203469ef4672 (1 revision) (flutter/flutter#170959)
2025-06-21 [email protected] Roll Dart SDK from 6325aeacaef4 to e5db5e0f81ba (1 revision) (flutter/flutter#170958)
2025-06-21 [email protected] Roll Dart SDK from a6a3d65e33d7 to 6325aeacaef4 (2 revisions) (flutter/flutter#170955)
2025-06-21 [email protected] Roll Skia from 773188560221 to dceb857b1c47 (1 revision) (flutter/flutter#170954)
2025-06-21 [email protected] Roll Dart SDK from 750eaa028445 to a6a3d65e33d7 (1 revision) (flutter/flutter#170953)
2025-06-21 [email protected] Fix the Japanese IME problem on macOS reported in the following issue. (flutter/flutter#166291)
2025-06-21 [email protected] Roll Fuchsia Test Scripts from IfPORaYjQ2zP4bcq-... to 2wEtX_lDNhHhDNsP6... (flutter/flutter#170946)
2025-06-20 [email protected] Roll Skia from 104460420c48 to 773188560221 (2 revisions) (flutter/flutter#170942)
2025-06-20 [email protected] Normalize AppBarTheme (flutter/flutter#169130)
2025-06-20 [email protected] Close CupertinoContextMenu overlay if the widget is disposed or a new route is pushed (flutter/flutter#170186)
2025-06-20 [email protected] Roll Dart SDK from a554bdd0a2cc to 750eaa028445 (1 revision) (flutter/flutter#170933)
2025-06-20 [email protected] Roll Skia from b638003de37e to 104460420c48 (1 revision) (flutter/flutter#170932)
2025-06-20 [email protected] Roll Packages from 0ec4053 to 7f41e75 (1 revision) (flutter/flutter#170925)
2025-06-20 [email protected] Roll Skia from f1e68950ea7b to b638003de37e (5 revisions) (flutter/flutter#170923)
2025-06-20 [email protected] [licenses_cpp] jun17 (flutter/flutter#170845)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [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
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
…r#9472)

flutter/flutter@c7362b4...0ab008a

2025-06-22 [email protected] Roll Skia from 203469ef4672 to fcd1c55da9cc (1 revision) (flutter/flutter#170986)
2025-06-22 [email protected] Roll Dart SDK from e5db5e0f81ba to 98db1db5ff65 (2 revisions) (flutter/flutter#170979)
2025-06-21 [email protected] Normalize input decoration theme (flutter/flutter#168981)
2025-06-21 [email protected] Roll Skia from dceb857b1c47 to 203469ef4672 (1 revision) (flutter/flutter#170959)
2025-06-21 [email protected] Roll Dart SDK from 6325aeacaef4 to e5db5e0f81ba (1 revision) (flutter/flutter#170958)
2025-06-21 [email protected] Roll Dart SDK from a6a3d65e33d7 to 6325aeacaef4 (2 revisions) (flutter/flutter#170955)
2025-06-21 [email protected] Roll Skia from 773188560221 to dceb857b1c47 (1 revision) (flutter/flutter#170954)
2025-06-21 [email protected] Roll Dart SDK from 750eaa028445 to a6a3d65e33d7 (1 revision) (flutter/flutter#170953)
2025-06-21 [email protected] Fix the Japanese IME problem on macOS reported in the following issue. (flutter/flutter#166291)
2025-06-21 [email protected] Roll Fuchsia Test Scripts from IfPORaYjQ2zP4bcq-... to 2wEtX_lDNhHhDNsP6... (flutter/flutter#170946)
2025-06-20 [email protected] Roll Skia from 104460420c48 to 773188560221 (2 revisions) (flutter/flutter#170942)
2025-06-20 [email protected] Normalize AppBarTheme (flutter/flutter#169130)
2025-06-20 [email protected] Close CupertinoContextMenu overlay if the widget is disposed or a new route is pushed (flutter/flutter#170186)
2025-06-20 [email protected] Roll Dart SDK from a554bdd0a2cc to 750eaa028445 (1 revision) (flutter/flutter#170933)
2025-06-20 [email protected] Roll Skia from b638003de37e to 104460420c48 (1 revision) (flutter/flutter#170932)
2025-06-20 [email protected] Roll Packages from 0ec4053 to 7f41e75 (1 revision) (flutter/flutter#170925)
2025-06-20 [email protected] Roll Skia from f1e68950ea7b to b638003de37e (5 revisions) (flutter/flutter#170923)
2025-06-20 [email protected] [licenses_cpp] jun17 (flutter/flutter#170845)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop engine flutter/engine related. See also e: labels. platform-macos will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Japanese IME input is not working properly on macOS

6 participants