Prevent a new line in the middle of a sentance from sending a message #506

Merged
dan merged 1 commits from filesharing-persist into trunk 2022-07-06 22:02:04 +00:00
1 changed files with 4 additions and 0 deletions

View File

@ -628,6 +628,10 @@ class _MessageViewState extends State<MessageView> {
var data = event.data;
if (event is RawKeyUpEvent) {
if ((data.logicalKey == LogicalKeyboardKey.enter && !event.isShiftPressed) || data.logicalKey == LogicalKeyboardKey.numpadEnter && !event.isShiftPressed) {
// Don't send when inserting a new line that is not at the end of the message
if (ctrlrCompose.selection.baseOffset != ctrlrCompose.text.length) {
return;
}
_sendMessage();
}
}