-
Notifications
You must be signed in to change notification settings - Fork 6k
Add support for software text editing controls #15560
Conversation
|
Some comments about the limitations of this PR:
|
93d68c7 to
04685c5
Compare
justinmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few nitpicks but otherwise LGTM 👍
Right now this will not support the home/end buttons, so we should add a note to flutter/flutter#9419 about that when this is merged.
@GaryQian Any last minute ideas for getting the width here? Otherwise I think the current up/down arrow behavior is ok for now. Also, what do you think about tests for this?
shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java
Outdated
Show resolved
Hide resolved
|
Obtaining the width at the embedder level is non-trivial. Unless it is urgently needed, I would hold off on developing a system to pass width down to there. The sendKeyEvent method should be unit-testable? |
|
Alright let's leave the up/down behavior as-is for now and revisit if needed. Unit testing sounds like a good idea. @edman You'll have to add a new unit test file for this since one doesn't already exist for InputConnectionAdaptor unfortunately. It should be somewhat similar to the unit test file added in this PR: https://github.com/flutter/engine/pull/12432/files#diff-af19d10c7a69b9cab3ee96c4f64a9a9cR1 |
| // WIP | ||
| // The asserts below don't work. KEYCODE_DPAD_UP moves the caret to | ||
| // index 0, as if the text were in one single line. | ||
| // assertEquals(expectedSelection, Selection.getSelectionStart(editable)); | ||
| // assertEquals(expectedSelection, Selection.getSelectionEnd(editable)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't get the up/down tests to work as expected yet.
Up moves selection to beginning of the text and down moves to end. There's a line break in the text so it should move to the next/previous line instead.
Not sure why it behaves differently in tests.. Will look more tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I have noticed through working on other bugs that depending on the input method, some keystrokes/events do not pass through this method at all. I am not yet clear on where those events go but that behavior may have something to do with this.
|
|
|
|
|
@justinmc I changed the test logic and added a note. |
justinmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I think this way of doing the tests is fine with the note. There is one failure, I'll try to see if it's an infrastructure thing.
|
@gschier Thanks for pointing that out, I hadn't realized it was being handled in both places. I talked to @gspencergoog and it sounds like it's due for a refactor to consolidate. This should be fine for now. |
|
This pull request is not suitable for automatic merging in its current state.
|
|
Hmm I reran that failure and it succeeded, but it's still red. @edman Can you try merging with master and pushing? |
Includes selection, copy, cut, paste, as well as partial support for up and down movement. Text editing controls can be accessed in GBoard by: top-left arrow > three dots menu > text editing Partial fix for flutter/flutter#9419 and flutter/flutter#37371.
Run with: testing/run_tests.py --type=java --java-filter=io.flutter.plugin.editing.InputConnectionAdaptorTest
|
@GaryQian FYI we'll be landing this once the tree is green. |
* 9beac71 Add support for software text editing controls (flutter/engine#15560) * ab9f83f Roll fuchsia/sdk/core/linux-amd64 from RYDur... to bgFop... (flutter/engine#16855) * 62d0c08 Roll src/third_party/dart dda5bcee00d3..4dad6d77ba50 (6 commits) (flutter/engine#16856) * 76d12d2 Roll src/third_party/skia 03d9e8af0d25..262796edeba6 (11 commits) (flutter/engine#16857) * 01a52b9 Try rasterizing images and layers only once, even when their rasterization fails. Further enforce the same access threshold on layers as on Pictures. Previously layers would always be cached. The latter is a semantic change. (flutter/engine#16545) * 3b0d1a8 script for fetching correct flutter version (flutter/engine#16818) * 9746ddb Roll src/third_party/dart 4dad6d77ba50..6708f6d4c7df (15 commits) (flutter/engine#16860) * 90736bb Roll src/third_party/skia 262796edeba6..54cb21430ccb (23 commits) (flutter/engine#16861) * 142882e Roll src/third_party/skia 54cb21430ccb..e1ae9c4bcf2e (4 commits) (flutter/engine#16863) * 7192356 Manual roll of Dart 09bbd3cca5...6708f6d4c7 (flutter/engine#16864) * fae5ff6 Roll src/third_party/skia e1ae9c4bcf2e..5d1c3e2ead61 (2 commits) (flutter/engine#16865) * c6525a4 Roll src/third_party/skia 5d1c3e2ead61..59b160f99106 (2 commits) (flutter/engine#16866) * 755e2b5 Roll src/third_party/skia 59b160f99106..71a20b2685c6 (1 commits) (flutter/engine#16867) * 93d0eff Roll src/third_party/skia 71a20b2685c6..ecbb0fb2d5bc (1 commits) (flutter/engine#16869) * bfee5ae Roll fuchsia/sdk/core/linux-amd64 from bgFop... to F_Ihm... (flutter/engine#16871) * ca29b47 Roll fuchsia/sdk/core/mac-amd64 from K26F5... to 79I0C... (flutter/engine#16872) * 708ca2c Roll src/third_party/skia ecbb0fb2d5bc..666707336e07 (1 commits) (flutter/engine#16873) * 78ea291 Roll fuchsia/sdk/core/mac-amd64 from 79I0C... to NoQzJ... (flutter/engine#16874) * 7b43bb8 Roll fuchsia/sdk/core/linux-amd64 from F_Ihm... to 22R78... (flutter/engine#16875) * 75c9c62 Roll src/third_party/skia 666707336e07..231f1bf56556 (1 commits) (flutter/engine#16876) * 7a86b83 Roll src/third_party/dart 09bbd3cca5d4..860dca93ea42 (1 commits) (flutter/engine#16877) * d0c87e2 Roll src/third_party/skia 231f1bf56556..d6205322cdc5 (1 commits) (flutter/engine#16878) * b4c5854 Roll src/third_party/skia d6205322cdc5..6729496a037f (1 commits) (flutter/engine#16879) * 03f0ee5 Roll src/third_party/skia 6729496a037f..367dbff98555 (1 commits) (flutter/engine#16880) * d84b968 Roll fuchsia/sdk/core/mac-amd64 from NoQzJ... to q2DAy... (flutter/engine#16881) * 4490e7c Roll fuchsia/sdk/core/linux-amd64 from 22R78... to 9NHsJ... (flutter/engine#16882) * a39e7ac Roll src/third_party/skia 367dbff98555..986680240f81 (1 commits) (flutter/engine#16884) * 62b1e50 Roll src/third_party/dart 860dca93ea42..fbe9f6115d2f (9 commits) (flutter/engine#16885) * 5e474ee Roll src/third_party/skia 986680240f81..9dd0bd78b2d7 (2 commits) (flutter/engine#16886)
Fixes flutter/flutter#101569 This block of code was originally introduced in #15560 , but removing it does not have any affect on the software text editing controls in GBoard. Before this change * shift + arrow right/left selection would collapse after releasing the shift key. * shift + mouse click to expand selection would collapse after releasing the shift key. After this change * shift key up no longer collapses the selection.
Includes selection, copy, cut, paste, as well as partial support for up
and down movement.
Text editing controls can be accessed in GBoard by:
top-left arrow > three dots menu > text editing
Partial fix for flutter/flutter#9419 and flutter/flutter#37371.
Before
After