memspace / zefyr

Soft and gentle rich text editing for Flutter applications.
https://zefyr-editor.gitbook.io
2.22k stars 551 forks source link

Text loss with some Android keyboards #589

Open britannio opened 2 years ago

britannio commented 2 years ago

Steps to Reproduce

  1. Download the Typewise keyboard on Android
  2. Enter some text
  3. Delete each character slowly, then restore each one. This works as expected
  4. Delete a group of characters quickly, then restore each one. Some characters are lost, others are duplicated.

Example: https://photos.app.goo.gl/nSfXogKvZTRkzz7TA

I can't remember which Flutter version this issue was introduced in. Possibly when userUpdateTextEditingValue was introduced to Flutter's TextSelectionDelegate.

Logs

[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-x64, locale en-GB)
    • Flutter version 2.8.1 at /Users/britannio/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (3 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/britannio/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.10.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[☠] IntelliJ IDEA Ultimate Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:318:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1428:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1863:10)
      #15     runZonedGuarded (dart:async/zone.dart:1851:12)
      #16     runZoned (dart:async/zone.dart:1782:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:197:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:301:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:53:47)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1290:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1140:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:94:3)
      <asynchronous suspension>

[✓] VS Code (version 1.63.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.26.0

[✓] Connected device (3 available)
    • GM1913 (mobile) • 192.168.0.3:5555 • android-arm64  • Android 11 (API 30)
    • macOS (desktop) • macos            • darwin-x64     • macOS 12.1 21C52 darwin-x64
    • Chrome (web)    • chrome           • web-javascript • Google Chrome 96.0.4664.110
    ! Error: Britannio’s iPhone is not connected. Xcode will continue when Britannio’s iPhone is connected. (code -13)

! Doctor found issues in 2 categories.
britannio commented 2 years ago

It's worth noting that Flutter's TextField does behave correctly with the Typewise keyboard.

britannio commented 2 years ago

@pulyaevskiy Is there anything I can do to accelerate the fix for this? Also, I suspect that there are a select few Flutter maintainers responsible for the breaking changes to the editing API that have more context behind the issue. Maybe we can figure out who to contact?

cgestes commented 2 years ago

Hi,

Is this applied to the version of Zefyr you use: https://github.com/memspace/zefyr/pull/563

If no: can tou try it? If yes: can you try to revert it?

Good luck 😁

britannio commented 2 years ago

Hi,

Is this applied to the version of Zefyr you use: #563

If no: can tou try it? If yes: can you try to revert it?

Good luck 😁

Yes and reverting didn't fix it. git revert b540c8296b48b9fa978df90cba2599ef3d5fee8c -m 1

In fact, the issue is present in https://github.com/memspace/zefyr/commit/d9c3443297d378b2bba798bce4d975314d856e24 and possibly further back.

cgestes commented 2 years ago

Oh ok. Thanks for the investigation.

On Sat, Jan 29, 2022, 16:32 Britannio Jarrett @.***> wrote:

Hi,

Is this applied to the version of Zefyr you use: #563 https://github.com/memspace/zefyr/pull/563

If no: can tou try it? If yes: can you try to revert it?

Good luck 😁

Yes and reverting didn't fix it. git revert b540c8296b48b9fa978df90cba2599ef3d5fee8c -m 1

In fact, the issue is present in d9c3443 https://github.com/memspace/zefyr/commit/d9c3443297d378b2bba798bce4d975314d856e24 and possibly further back.

— Reply to this email directly, view it on GitHub https://github.com/memspace/zefyr/issues/589#issuecomment-1024932692, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAL75NYJKKIVLGLOPBFMALUYQB77ANCNFSM5LLAXJ4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>