-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#42648Closed
Copy link
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: desktopRunning on desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 3.6Found to occur in 3.6Found to occur in 3.6frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-linuxBuilding on or for Linux specificallyBuilding on or for Linux specificallyplatform-webWeb applications specificallyWeb applications specifically
Description
Steps to Reproduce
Hi. I am developing an editor and need to use DeltaTextInputClient to receive the user input. Now I am doing some work to support the IME. But I found that it behaves differently for different platforms' IMEs.
- git clone https://github.com/LucasXu0/AppFlowy
- git checkout Ubuntu_IME
- cd frontend/app_flowy/packages/appflowy_editor/example
- Execute
flutter runon the code sample
On Ubuntu 22.04, use the built-in Chinese input method.
5. input some text by IME.
6. The console will output
flutter: [DEBUG][input]: 2022-10-23 16:38:52.156089: (Instance of 'TextEditingDeltaReplacement')
flutter: [DEBUG][input]: 2022-10-23 16:38:52.156301: receive replacement: text = 为, composing = TextRange(start: 0, end: 1), selection = TextRange(start: 0, end: 1), old text =
flutter: [DEBUG][input]: 2022-10-23 16:38:53.135127: (Instance of 'TextEditingDeltaReplacement')
flutter: [DEBUG][input]: 2022-10-23 16:38:53.135340: receive replacement: text = 外文, composing = TextRange(start: 0, end: 2), selection = TextRange(start: 0, end: 2), old text = 为
flutter: [DEBUG][input]: 2022-10-23 16:38:54.168940: (Instance of 'TextEditingDeltaInsertion')
flutter: [DEBUG][input]: 2022-10-23 16:38:54.169132: receive insertion: text = 外文, composing = TextRange(start: -1, end: -1), selection = TextSelection.collapsed(offset: 4, affinity: TextAffinity.downstream, isDirectional: false)
flutter: [DEBUG][input]: 2022-10-23 16:38:54.174651: (Instance of 'TextEditingDeltaNonTextUpdate')
On macOS, use the built-in Chinese input method.
5. input some text by IME.
6. The console will output
flutter: [DEBUG][input]: 2022-10-23 17:59:17.606751: (Instance of 'TextEditingDeltaInsertion')
flutter: [DEBUG][input]: 2022-10-23 17:59:17.606847: receive insertion: text = w, composing = TextRange(start: 0, end: 1), selection = TextSelection.collapsed(offset: 1, affinity: TextAffinity.downstream, isDirectional: false)
flutter: [DEBUG][input]: 2022-10-23 17:59:17.630399: (Instance of 'TextEditingDeltaNonTextUpdate')
flutter: [DEBUG][input]: 2022-10-23 17:59:17.630577: receive non text update: composing = TextRange(start: 0, end: 1), selection = TextSelection.collapsed(offset: 1, affinity: TextAffinity.downstream, isDirectional: false)
flutter: [DEBUG][input]: 2022-10-23 17:59:18.074047: (Instance of 'TextEditingDeltaInsertion')
flutter: [DEBUG][input]: 2022-10-23 17:59:18.074145: receive insertion: text = w, composing = TextRange(start: 0, end: 3), selection = TextSelection.collapsed(offset: 3, affinity: TextAffinity.downstream, isDirectional: false)
flutter: [DEBUG][input]: 2022-10-23 17:59:18.095028: (Instance of 'TextEditingDeltaNonTextUpdate')
flutter: [DEBUG][input]: 2022-10-23 17:59:18.095049: receive non text update: composing = TextRange(start: 0, end: 3), selection = TextSelection.collapsed(offset: 3, affinity: TextAffinity.downstream, isDirectional: false)
flutter: [DEBUG][input]: 2022-10-23 17:59:31.425438: (Instance of 'TextEditingDeltaReplacement')
flutter: [DEBUG][input]: 2022-10-23 17:59:31.425573: receive replacement: text = 问我, composing = TextRange(start: -1, end: -1), selection = TextRange(start: 0, end: 3), old text = w w
Expected results:
I think the behavior for Linux should be the same as macOS.
Actual results:
On Linux, the callback will be like
- input w -> receive a
replacementaction. - input w again -> receive a
replacementaction again. - press whitespace -> receive an
insertionaction.
It makes the text will be duplicated.
On macOS, the callback will be like
- input w -> receive an
insertionaction. - input w again -> receive an
insertionaction again. - press whitespace -> receive a
replacementaction. Replace the previous characters with the result text.
Flutter Environment
Linux
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, 3.0.5, on Ubuntu 22.04.1 LTS 5.15.0-50-generic, locale en_US.UTF-8)
macOS
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, 3.0.5, on macOS 13.0 22A5358e darwin-arm, locale en-CN)
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: desktopRunning on desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 3.6Found to occur in 3.6Found to occur in 3.6frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-linuxBuilding on or for Linux specificallyBuilding on or for Linux specificallyplatform-webWeb applications specificallyWeb applications specifically

