Corrected newline inserting when using shift+return while writing SMS messages

Shift+return was always inserting newline at the end of the current line of text, ignoring where the cursor was, and not overriding currently selected text

BUG: 488585
This commit is contained in:
Ryan Frew 2024-06-28 10:07:46 +12:00 committed by Albert Vaca Cintora
parent 0a0ad1b439
commit d03e964ed7

View file

@ -84,7 +84,9 @@ ColumnLayout {
Keys.onReturnPressed: event => { Keys.onReturnPressed: event => {
if (event.key === Qt.Key_Return) { if (event.key === Qt.Key_Return) {
if (event.modifiers & Qt.ShiftModifier) { if (event.modifiers & Qt.ShiftModifier) {
messageField.append("") //remove any selected text and insert new line at cursor position
messageField.cursorSelection.text = ""
messageField.insert(messageField.cursorPosition,"\n")
} else { } else {
sendButton.clicked() sendButton.clicked()
event.accepted = true event.accepted = true