Fix new line and enter key presses deleting existing text in some keyboards (#7437)

This commit is contained in:
Jorge Martin Espinosa 2022-10-31 16:16:42 +01:00 committed by GitHub
parent ce35472824
commit 76ead3f344
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

1
changelog.d/7357.bugfix Normal file
View file

@ -0,0 +1 @@
New line and Enter hardware key presses deleting existing text in some keyboards.

View file

@ -294,11 +294,11 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
!keyEvent.isShiftPressed &&
keyEvent.keyCode == KeyEvent.KEYCODE_ENTER &&
resources.configuration.keyboard != Configuration.KEYBOARD_NOKEYS
val result = if (isSendAction || externalKeyboardPressedEnter) {
val sendMessageWithEnter = externalKeyboardPressedEnter && vectorPreferences.sendMessageWithEnter()
val result = if (isSendAction || sendMessageWithEnter) {
sendTextMessage(v.text)
true
} else false
composer.setTextIfDifferent(null)
result
}