Skip to content

Commit

Permalink
fix(talk_app): Fix inserting emoji if text selection is invalid
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Nov 1, 2024
1 parent 0d3eba8 commit 4095aa3
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class _TalkMessageInputState extends State<TalkMessageInput> {
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,
Expand Down

0 comments on commit 4095aa3

Please sign in to comment.