-
Notifications
You must be signed in to change notification settings - Fork 901
Chore(breaking changes): Replace TextInputClient with DeltaTextInputClient #2510
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
base: master
Are you sure you want to change the base?
Conversation
…ingerdmx#2483) * docs: update controller length extension method deprecation message * docs: update changelog
Co-authored-by: CatHood0 <[email protected]>
…ute (singerdmx#2438) * feat: Enable BoxDecoration for DefaultTextBlockStyle of header Attribute --------- Co-authored-by: Ellet <[email protected]>
… of page route changing when editor is set to readonly. (singerdmx#2488) Co-authored-by: chaos <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
Although it solves several problems for desktop and mobile devices, it seems to behave strangely on the web. I wonder what's causing it to behave this way, when in reality, we're doing exactly the same thing as before, but with a little extra code. For example:
issue_with-2025-03-11_22.42.09.mp4Update: this part was solved by leaving the old implementation for the web (I'll need to make further changes to remove it and get the new one working properly). In any case, this is just a temporary solution. |
This comment was marked as resolved.
This comment was marked as resolved.
@EchoEllet What do you think about using DeltaTextInputClient instead of
No, we cannot have the /// Whether to enable that the engine sends text input updates to the
/// framework as [TextEditingDelta]'s or as one [TextEditingValue].
///
/// Enabling this flag results in granular text updates being received from the
/// platform's text input control.
///
/// When this is enabled:
/// * You must implement [DeltaTextInputClient] and not [TextInputClient] to
/// receive granular updates from the platform's text input.
/// * Platform text input updates will come through
/// [DeltaTextInputClient.updateEditingValueWithDeltas].
/// * If [TextInputClient] is implemented with this property enabled then
/// you will experience unexpected behavior as [TextInputClient] does not implement
/// a delta channel.
///
/// When this is disabled:
/// * If [DeltaTextInputClient] is implemented then updates for the
/// editing state will continue to come through the
/// [DeltaTextInputClient.updateEditingValue] channel.
/// * If [TextInputClient] is implemented then updates for the editing
/// state will come through [TextInputClient.updateEditingValue].
///
/// Defaults to false.
final bool enableDeltaModel; I'd like to hear your opinion. UpdateI'm currently testing whether this implementation is actually worthwhile. So far, I haven't encountered any issues, but I'm sure some tweaks will need to be made. In any case, I strongly believe we should use The only thing that allows _textInputConnection = TextInput.attach(
this,
TextInputConfiguration(
inputType: TextInputType.multiline,
readOnly: widget.config.readOnly,
+ enableDeltaModel: true,
inputAction: widget.config.textInputAction,
enableSuggestions: !widget.config.readOnly,
keyboardAppearance: widget.config.keyboardAppearance ??
CupertinoTheme.maybeBrightnessOf(context) ??
Theme.of(context).brightness,
textCapitalization: widget.config.textCapitalization,
allowedMimeTypes: widget.config.contentInsertionConfiguration == null
? const <String>[]
: widget.config.contentInsertionConfiguration!.allowedMimeTypes,
), |
@EchoEllet do you know what could be happening here? I'm just using [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PathNotFoundException: Cannot delete file, path = '/tmp/quill_native_bridge_linux/xclip' (OS
Error: No existe el fichero o el directorio, errno = 2)
#0 _checkForErrorResponse (dart:io/common.dart:58:9)
#1 _File._delete.<anonymous closure> (dart:io/file_impl.dart:352:9)
<asynchronous suspension>
#2 QuillNativeBridgeLinux.getClipboardImage (package:quill_native_bridge_linux/quill_native_bridge_linux.dart:200:7)
<asynchronous suspension>
#3 DefaultClipboardService.getImageFile (package:flutter_quill/src/editor_toolbar_controller_shared/clipboard/default_clipboard_service.dart:28:12)
<asynchronous suspension>
#4 QuillController.clipboardPaste (package:flutter_quill/src/controller/quill_controller.dart:589:26)
<asynchronous suspension>
#5 QuillRawEditorState.pasteText (package:flutter_quill/src/editor/raw_editor/raw_editor_state.dart:145:9)
<asynchronous suspension> |
Yeah, i'm noticing that these changes breaks out tests since flutter_quill_test API does not support |
Is this #2510 (comment) probably related with #2450? |
I only test this "hack" in Android. I've managed to reproduce the problem. Now, if you select text, it won't appear. You have to do a little hack. Steps:
This may not be easy to reproduce. But it's as simple as not giving the editor time to process what's happening. It stops happening if you first select, wait a moment, and then type. What could be happening?I suspect this is because the That is, it is an event error that occurs if they are executed at the same time, causing them to collide, since both have their own values, but they do not know which should be executed first and which should not. @EchoEllet what do you think? For example, if (_isApplyingDeltas) {
// We're in the middle of applying a series of text deltas. Don't
// send any updates to the IME because it will conflict with the
// changes we're actively processing.
editorImeLog.fine("Ignoring new TextEditingValue because we're applying deltas");
return;
} |
I'll start updating these PRs and finishing them. I've been a bit busy, and I'll likely have less time in the near future for certain personal reasons. Still, I'll continue to help however I can. |
Is there anything I can do to get it fixed? I'm having a lot of bugs due to this problem and I'm available to help |
I missed the notification. This is probably a bug. The plugin should remove this file if it hasn't already been removed by the system. Could you share details including the desktop environment and the distro, and whether if you're using any sandboxing to run the app (e.g. Flatpak). Please consider filing an issue to quill-native-bridge repo if you have the time. Unfortunately, I'm not able to work on the project for this period of time. This line could be related. |
I'm using Debian 12 with the Kernel 6.12.12. And I'm just running the app directly using
Let me reproduce the problem again and add more details to the issue. And don't worry about the difficulty over time issue. I understand. I'm exactly the same right now. |
It's not much at the moment. We're just having issues with how Also, on the Web, there seem to be some issues when moving the cursor up or down using This last issue is something Flutter is currently having (the same thing is happening with text selection). I was waiting for Flutter to release a new update to check if they had fixed this issue, but nothing has happened yet. In any case, the comments (most of which are active on this PR) have information about the problems we are having that cause the PR not to be merged. |
Could you provide some steps on how you're testing this change so I can reproduce on macOS and iOS? |
Description
The previous implementation of applying changes in the
TextInputClient
worked well and did the job that was expected of it, but it was not very easy to read (not everyone investigates what theDiff
class is), and sometimes it was somewhat complicated to modify (at least in my case), since it depended a lot on what was obtained from theDiff
object.This change is actually quite simple.
Warning
I've marked this change as potentially breaking, as we'll likely need to modify the testing API to now use TextEditingDelta values if this PR is to be merged.
Using the available
TextEditingDelta
classesWhat we did was go from applying the changes directly to dividing the logic into different sections:
ime
: In this folder, we find the most common methods used to apply theTextEditingDeltas
we obtained fromupdateEditingValueWithDeltas
. Here, you can find methods such asonReplace
,onInsert
,onDelete
, oronNonTextUpdate
, which have their own logic for each use case.Was this change really necessary?
Yes, since this allows us to obtain more granular changes and avoids having to use a method like getDiff, which, in the long run (or for long documents), ruins the user experience quite a bit when having to compare large changes that occur in the editor.
We went from applying the
Diff
class directly to thereplaceText
, to instead obtaining specific classes for each use case/type of change made, which makes the logic for applying them more independent.Some of the advantages of this change are:
TextEditingDelta
gives to us.Related Issues
Type of Change
TODO
TextEditingValue
passed)