chore: only trigger onPaste callback when text left increases by >1 character (#2046)

This commit is contained in:
ggurdin 2025-03-05 13:36:25 -05:00 committed by GitHub
parent c9dbbe73b8
commit 714613f871
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -66,7 +66,7 @@ class Choreographer {
InputPasteListener(
_textController,
// TODO, do something on paste
() {},
() => debugPrint("on paste"),
);
itController = ITController(this);
igc = IgcController(this);

View file

@ -17,7 +17,7 @@ class InputPasteListener {
if (controller.editType != EditType.keyboard) return;
final difference =
controller.text.characters.length - _currentText.characters.length;
if (difference.abs() > 1) onPaste();
if (difference > 1) onPaste();
_currentText = controller.text;
});
}