Skip to content

Conversation

@cbracken
Copy link
Member

The TextInput.setMarkedRect message was originally added to support
positioning the IME candidates menu on iOS, but is now used by iOS,
Windows, macOS, and Linux desktop embedders.

No tests added since this is a documentation-only fix.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • 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 ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt.
  • All existing and new tests are passing.

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

The TextInput.setMarkedRect message was originally added to support
positioning the IME candidates menu on iOS, but is now used by iOS,
Windows, macOS, and Linux desktop embedders.
@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Mar 11, 2021
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

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.

@knopp
Copy link
Member

knopp commented Mar 11, 2021

I am a bit confused, is setMarketTextRect used on macOS? The rect is only valid during compositing, that's why I added setCaretRect in #77608.

@LongCatIsLooong
Copy link
Contributor

@knopp it says

is used for positioning the IME candidates menu

so it's not directly related to the caret I think.

@knopp
Copy link
Member

knopp commented Mar 11, 2021

@knopp it says

is used for positioning the IME candidates menu

so it's not directly related to the caret I think.

The IME candidates menu on Mac is displayed on caret position outside of composition mode.

@cbracken
Copy link
Member Author

cbracken commented Mar 11, 2021

I am a bit confused, is setMarkedTextRect used on macOS? The rect is only valid during compositing, that's why I added setCaretRect in #77608.

We use setMarkedTextRect for IME candidate menu positioning on all platforms other than macOS (and Android) at the moment. The only reason it hasn't been done it that I got pulled away from CJK support for macOS midway through coding up the PR since I was scheduled for engine sheriff rotation, and then to get CppWinRT packaged up as a CIPD package for Windows.

Using the caret position would result in incorrect positioning for the IME candidate menu on macOS, since it needs to be positioned at the bottom-left corner of the composing region, and doesn't move with the caret. That behaviour is platform-specific.

Example of the expected behaviour:
image

The correct behaviour is actually predicated on implementing #68547, since it's really the active subrange that we care about, not the full composing region.

@knopp
Copy link
Member

knopp commented Mar 11, 2021

I see. Wasn't aware of #68547. Thanks for the clarification!

@cbracken
Copy link
Member Author

#68547 is interesting since this will affect all platforms once we have proper modelling for it in the framework. It's not an issue for soft keybards, but we'll definitely need it for desktop and iOS with physical keyboards. When I originally added IME support for iOS/Android in 2016, hardware keyboards were pretty low on our list of priorities, unfortunately.

In the meantime, the bottom-left of the composing region is about as close as we can get on platforms like macOS that avoid moving the IME candidate menu.

@cbracken
Copy link
Member Author

Added a video to #68547 to give a better idea.

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@cbracken cbracken merged commit aee756f into flutter:master Mar 11, 2021
@cbracken cbracken deleted the composing-rect-docs branch March 11, 2021 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants