-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Hitting suppr
causes DeltaTextInputClient to send incorrect TextEditingDeletion on Web platform
#1424
Comments
suppr
causes DeltaTextInputClient to send incorrect TextEditingDeletionsuppr
causes DeltaTextInputClient to send incorrect TextEditingDeletion on Web platform
Transferring this to samples github repo. |
PTAL @Renzo-Olivares |
Nothing is wrong with the sample code The issue is with It's complicated to setup working example to demonstrate the problem but it can be easily reproduced with the sample |
Can you please have a look? This is blocking our project |
@amantoux Thank you, I'll take a look. I'm able to reproduce this on my end. |
btw backspace doesn't work correctly either on the web, in the example deleting multiples chars in a row with backspace make the text alternates between two differents values. deleting "brown", I get: if I click anywhere on the text it alternates with: If I select some text, the alternation stops. |
While learning the inner-workings of Flutter text editing, I have investigated this issue. It is reproducible on Desktop too (Linux on my side, I have yet to test it on other platforms). To repro on Linux, I run the updated version of From my understanding, the sample code doesn’t make a distinction between DeleteCharacterIntent: CallbackAction<DeleteCharacterIntent>(
onInvoke: (intent) => _delete(intent.forward),
),
// And update _delete method to use this parameter to remove the right character @Renzo-Olivares As you have a deep understanding of this, is relying on |
@cgestes I think that issue might be isolated to this demo. @bleroux On the web side, the engine is sending the wrong delta offset (this sample ignores shortcuts for web). On the desktop side of things, the fix you described will work since |
@Renzo-Olivares Many thanks for your insights, it helps me go deeper into this investigation. I found that even for Web the delete key is handled by a So, for both Web and desktop, Do you think that If not, this leads to a PR where For instance, while running the sample app with all default shortcuts overridden, it’s way easier to determine that the engine is sending a wrong |
@bleroux Oh thats interesting, I can confirm that the delete key is handled by the shortcut. The reason for that is that we don't handle When I add this mapping, I can confirm that the web is sending the wrong delta. I think the way forward is
What do you mean by I think those PRs are definitely worth it to work on, and I'd be happy to review them. I think the |
@Renzo-Olivares I was not aware of // in BasicTextInputClientState.build
return Shortcuts.manager(
manager: ShortcutManager(
modal: true,
shortcuts: shortcuts,
),
child: Actions(
actions: _actions, Your solution looks better. 😄
Great! I will work on this as soon as possible. |
This should be fixed with flutter/engine#36616 and #1458 |
Steps to Reproduce
suppr
on keyboardExpected results: Deletion Delta Offset =
(1,2)
Actual results: Deletion Delta Offset =
(0,1)
Code sample: https://github.com/flutter/samples/blob/main/simplistic_editor
The text was updated successfully, but these errors were encountered: