Merge pull request 'Prevent a new line in the middle of a sentance from sending a message' (#506) from filesharing-persist into trunk
continuous-integration/drone/push Build is passing Details

Reviewed-on: #506
This commit is contained in:
Dan Ballard 2022-07-06 22:02:03 +00:00
commit 62ea8278f3
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();
}
}