-
Notifications
You must be signed in to change notification settings - Fork 904
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
Draft
CatHood0
wants to merge
44
commits into
singerdmx:master
Choose a base branch
from
CatHood0:better_soft_keyboard_support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 18 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
3297a1f
Chore: improved input client service
b812460
Chore: minor changes
7685b57
Chore: renamed input client to the old name of the text input clinet
5a3dab3
Chore: removed unnecessary print
e039446
Chore: moved internal editing extensions and change List deltas to a …
bcacc27
Chore: removed unused import
a4d567a
doc: update controller length extension method deprecation message (#…
realth000 1a287b7
chore: update GitHub bug template to require the package version input
EchoEllet 54ccff3
Focus and open context menu on right click if unfocused (#2477)
tjarvstrand dfb7bbc
Expose Rule type so that Document.setCustomRules can be used (#2484)
tjarvstrand eb91d24
feat: Enable BoxDecoration for DefaultTextBlockStyle of header Attrib…
satotoshitaka11 8d63996
fix: unpredictable endless loop of '_handleFocusChanged' in the phase…
chaosue 62ecf21
chore(release): prepare to publish 11.1.0
EchoEllet 24e1305
Chore: added change to CHANGELOG
3a147cf
Merge branch 'master' into improve_input_client
CatHood0 9000119
Chore: minor changes
1518987
Chore: removed debounce timer since it does not needed in our impleme…
50a1499
Chore: removed commented neccesary schedulers
d998e45
Chore: removed unnecessary _updateComposing method
6ceef54
Fix: buggy behavior of the caret when try to delete characters on and…
fd66368
Chore: used old implementation for web since the new one does not wor…
e98e16d
Chore: removed composing range validation to get the cursorPosition f…
9202560
Chore: replaced use of dart:io to use platform utils
25d07ad
Chore: fix buggy behavior in onDelete on web browsers
9ff127d
Chore: removed formatters since them are not doing nothing and cause …
70ccec1
Chore: replaced get selection from controller to use the one from the…
b5ee9f4
Chore: removed unused import
aad0b56
Fix: removed unused imports and deleted import for formatters
ea112f1
Chore: removed unnecessary double check for use CharacterShortcutEvet…
fa3dbc3
Chore: updated change title in CHANGELOG
f12327b
Chore: update pubspec.lock from example
b1fbe0a
Chore: use insertion.insertionOffset instead selection from new value
2e1de1d
merge branch 'master' into better_soft_keyboard_support
f59c58b
Chore: improved perfomance of ime operations
155491f
Chore: removed unused imports in text_input_mixin
cf46f8c
Merge branch 'master' into better_soft_keyboard_support
EchoEllet 1d0aa63
Chore: implemented delta_text_input_client instead diffing string cha…
2936b93
Chore: format
a9f2b5b
Chore: removed TextInputClient by recommendation of flutter docs
44bdd3d
Chore: removed use of updateEditingValue by recommendation of flutter…
61d753d
Merge 'master' into better_soft_keyboard_support
924a27b
Chore: added method for apply deltas to the last known editing value
74287ae
Fix: missed method name change
dc438bf
Chore: moved ime helpers to be part of ime_internals file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import 'package:flutter/services.dart'; | ||
import '../../../delta/delta_diff.dart'; | ||
|
||
/// Return a list of the change type that was do it to the content of the editor | ||
TextEditingDelta getTextEditingDelta( | ||
TextEditingValue? oldValue, | ||
TextEditingValue newValue, | ||
) { | ||
if (oldValue == null || oldValue.text == newValue.text) { | ||
return TextEditingDeltaNonTextUpdate( | ||
oldText: newValue.text, | ||
selection: newValue.selection, | ||
composing: newValue.composing, | ||
); | ||
} | ||
final currentText = oldValue.text; | ||
final diff = getDiff( | ||
currentText, | ||
newValue.text, | ||
newValue.selection.extentOffset, | ||
); | ||
if (diff.inserted.isNotEmpty && diff.deleted.isEmpty) { | ||
return TextEditingDeltaInsertion( | ||
oldText: currentText, | ||
textInserted: diff.inserted, | ||
insertionOffset: diff.start, | ||
selection: newValue.selection, | ||
composing: newValue.composing, | ||
); | ||
} else if (diff.inserted.isEmpty && diff.deleted.isNotEmpty) { | ||
return TextEditingDeltaDeletion( | ||
oldText: currentText, | ||
selection: newValue.selection, | ||
composing: newValue.composing, | ||
deletedRange: TextRange( | ||
start: diff.start, | ||
end: diff.start + diff.deleted.length, | ||
), | ||
); | ||
} else if (diff.inserted.isNotEmpty && diff.deleted.isNotEmpty) { | ||
return TextEditingDeltaReplacement( | ||
oldText: currentText, | ||
selection: newValue.selection, | ||
composing: newValue.composing, | ||
replacementText: diff.inserted, | ||
replacedRange: TextRange( | ||
start: diff.start, | ||
end: diff.start + diff.deleted.length, | ||
), | ||
); | ||
} else if (diff.inserted.isEmpty && diff.deleted.isEmpty) { | ||
return TextEditingDeltaNonTextUpdate( | ||
oldText: newValue.text, | ||
selection: newValue.selection, | ||
composing: newValue.composing, | ||
); | ||
} | ||
throw UnsupportedError('Unknown diff: $diff'); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.