From 6919ea6b32b2912c1eb1d4488812c88c8522de98 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Fri, 1 Nov 2024 13:34:13 +0100 Subject: [PATCH] fix(talk_app): Fix inserting emoji if text selection is invalid Signed-off-by: provokateurin --- .../packages/talk_app/lib/src/widgets/message_input.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/neon_framework/packages/talk_app/lib/src/widgets/message_input.dart b/packages/neon_framework/packages/talk_app/lib/src/widgets/message_input.dart index 52a203b810e..58817eaad6f 100644 --- a/packages/neon_framework/packages/talk_app/lib/src/widgets/message_input.dart +++ b/packages/neon_framework/packages/talk_app/lib/src/widgets/message_input.dart @@ -116,7 +116,7 @@ class _TalkMessageInputState extends State { final textSelection = controller.selection; controller - ..text = text.replaceRange(textSelection.start, textSelection.end, emoji) + ..text = !textSelection.isValid ? emoji : text.replaceRange(textSelection.start, textSelection.end, emoji) ..selection = textSelection.copyWith( baseOffset: textSelection.start + emoji.length, extentOffset: textSelection.start + emoji.length,