Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve changes application from TextInputClient #2510

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

CatHood0
Copy link
Collaborator

@CatHood0 CatHood0 commented Mar 12, 2025

Description

Previously, our TextInputClient implementation only allowed for one specific action during the updateEditingValue call: applying the new (or removed) text to the document. However, it didn't have good support for CharacterShorcutEvents when applying them to virtual keyboards.

For this purpose, a new implementation was created that allows for more explicit retrieval of the type of change made to the document/text and for simple application.

This description will be updated soon to provide more information on why it was done this way.

Note

This PR fixes the issue where the cursor isn't synchronized with keyboard events and positions the caret in places it shouldn't. I've at least tried reproducing the issue on physical devices, and it seems to have been completely eliminated. I'll have to test whether this issue has also been resolved on emulators.

Related Issues

Type of Change

  • Feature: New functionality without breaking existing features.
  • 🛠️ Bug fix: Resolves an issue without altering current behavior.
  • 🧹 Refactor: Code reorganization, no behavior change.
  • Breaking: Alters existing functionality and requires updates.
  • 🧪 Tests: New or modified tests
  • 📝 Documentation: Updates or additions to documentation.
  • 🗑️ Chore: Routine tasks, or maintenance.
  • Build configuration change: Build/configuration changes.

TODO

  • check if works for all platforms (i'll need some help with apple OS)
  • fix buggy behavior on deletion operations in web browsers
  • fix buggy behavior in android (the caret is not synced with the TextEditingValue passed)

CatHood0 and others added 16 commits February 21, 2025 01:13
…ingerdmx#2483)

* docs: update controller length extension method deprecation message

* docs: update changelog
Co-authored-by: CatHood0 <santiagowmar@gmail.com>
…ute (singerdmx#2438)

* feat: Enable BoxDecoration for DefaultTextBlockStyle of header Attribute

---------

Co-authored-by: Ellet <echo.ellet@gmail.com>
… of page route changing when editor is set to readonly. (singerdmx#2488)

Co-authored-by: chaos <chaos@veigit.com>
@CatHood0 CatHood0 added enhancement New feature or request in progress This issue or feature is currently being worked on by someone. labels Mar 12, 2025
@CatHood0 CatHood0 self-assigned this Mar 12, 2025
@CatHood0 CatHood0 marked this pull request as draft March 12, 2025 00:42
@CatHood0 CatHood0 requested review from EchoEllet and singerdmx March 12, 2025 00:47
@CatHood0

This comment was marked as resolved.

@CatHood0
Copy link
Collaborator Author

CatHood0 commented Mar 12, 2025

If you're wondering why this PR suddenly has commits from other PRs, it was my mistake when trying to get the latest changes from master, using git pull instead of git merge.

@CatHood0

This comment was marked as resolved.

@CatHood0 CatHood0 changed the title Chore: improved support for soft-keyboards on the TextInputClient Chore: improved the way we apply changes from TextInputClient Mar 12, 2025
// formatting method for the specific delta type (insertion, deletion, replacement, or non-text update).
// If the delta type is not recognized, it throws an UnimplementedError.
@internal
@experimental
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I need to improve the documentation of these extensions.

url: "https://pub.dev"
source: hosted
version: "0.7.4"
version: "0.7.3"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Idk why this change was included, since i didn't change anything on the example.

@CatHood0
Copy link
Collaborator Author

CatHood0 commented Mar 12, 2025

Important

I've been testing the change made in #2505, and it seems that when you press shift+arrow down in a Header block, it suddenly selects more text than it should (i'm gonna add a video later).

I can't say exactly why, but it seems like the change made in that PR needs to be tested, as it could impact the experience for users who aren't using any Chinese IME.

url: "https://pub.dev"
source: hosted
version: "3.0.9"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you using the latest stable Flutter SDK?

}
}

if (Platform.isIOS) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This wouldn't work on web, use isIOSApp or isIOS (which is true when on iOS even on a browser) instead.

@EchoEllet
Copy link
Collaborator

EchoEllet commented Mar 12, 2025

Idk exactly why, but, when i use web browsers, this exceptions are throwed:

That's because you're using dart:io on the web, which is not supported. We prefer not to import 'dart:io` at all or use conditional imports if necessary (which is error-prone) to get full score on pub.dev.

@EchoEllet EchoEllet changed the title Chore: improved the way we apply changes from TextInputClient chore: improve changes application from TextInputClient Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in progress This issue or feature is currently being worked on by someone.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants