Skip to content

[macOS] - Text deltas are buggy with special characters #101013

@matthew-carroll

Description

@matthew-carroll

On Mac OS, entering special characters with text deltas, such as opt+u and opt+n, results in buggy behavior.

This problem might exist on Windows and Linux. I don't have access to machines to test it.

When entering a "˜" with opt+n, for example, instead of an insertion delta, we get a replacement delta. This results in the removal of a character that the user didn't want to remove.

Screen.Recording.2022-03-29.at.8.17.58.PM.mov
flutter: INFO: 2022-03-29 20:24:02.300713: User tapped at text offset 1
flutter: FINE: 2022-03-29 20:24:02.306272: Is attached to input client? true
flutter: INFO: 2022-03-29 20:24:02.313812: Received list of text editing deltas.
flutter: INFO: 2022-03-29 20:24:02.313896:  - delta: Instance of 'TextEditingDeltaNonTextUpdate'
flutter: INFO: 2022-03-29 20:24:02.314053:  - old text: Hello, world!
flutter: INFO: 2022-03-29 20:24:02.315779: Received list of text editing deltas.
flutter: INFO: 2022-03-29 20:24:02.315834:  - delta: Instance of 'TextEditingDeltaNonTextUpdate'
flutter: INFO: 2022-03-29 20:24:02.315868:  - old text: Hello, world!
flutter: INFO: 2022-03-29 20:24:03.812027: Received list of text editing deltas.
flutter: INFO: 2022-03-29 20:24:03.812117:  - delta: Instance of 'TextEditingDeltaReplacement'
flutter: INFO: 2022-03-29 20:24:03.812157:  - old text: Hello, world!
flutter: INFO: 2022-03-29 20:24:03.812337:  - replacing: e
flutter: INFO: 2022-03-29 20:24:03.812439:  - with text: ˜
flutter: INFO: 2022-03-29 20:24:03.812559:  - replaced range: TextRange(start: 1, end: 2)
flutter: INFO: 2022-03-29 20:24:03.813473: Received list of text editing deltas.
flutter: INFO: 2022-03-29 20:24:03.813533:  - delta: Instance of 'TextEditingDeltaNonTextUpdate'
flutter: INFO: 2022-03-29 20:24:03.813566:  - old text: H˜llo, world!
flutter: INFO: 2022-03-29 20:24:05.321640: Received list of text editing deltas.
flutter: INFO: 2022-03-29 20:24:05.321806:  - delta: Instance of 'TextEditingDeltaNonTextUpdate'
flutter: INFO: 2022-03-29 20:24:05.321881:  - old text: H˜llo, world!
flutter: INFO: 2022-03-29 20:24:05.322854: Received list of text editing deltas.
flutter: INFO: 2022-03-29 20:24:05.322958:  - delta: Instance of 'TextEditingDeltaNonTextUpdate'
flutter: INFO: 2022-03-29 20:24:05.323023:  - old text: H˜llo, world!

You can reproduce this same situation by copying the implementation of simple_deltas_input.dart from this PR:
https://github.com/superlistapp/super_editor/pull/500/files#diff-d8a7604dfb54eac1f4a86d074736eacdbc9ddcc4430de3738b0360ab77584aa2

Also, if you enter opt+u, it also produces a replacement delta, and sometimes the delta tries to insert the character at unexpected positions, possibly resulting in an infinite loop going back-and-forth with the IME.

Flutter version

Flutter 2.10.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 7e9793dee1 (4 weeks ago) • 2022-03-02 11:23:12 -0600
Engine • revision bd539267b4
Tools • Dart 2.16.1 • DevTools 2.9.2

Metadata

Metadata

Labels

P0Critical issues such as a build break or regressiona: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemscustomer: productcustomer: todofound in release: 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions