From 603276ee0a7e50f4355efd926da7ee4bfc468296 Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Sat, 4 Oct 2025 11:52:01 -0500 Subject: [PATCH] feat(chat): (re)allow multi-line messages in text input (#3329) Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com> --- .../java/com/geeksville/mesh/ui/message/Message.kt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/ui/message/Message.kt b/app/src/main/java/com/geeksville/mesh/ui/message/Message.kt index d5df880f7..12f3d111b 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/message/Message.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/message/Message.kt @@ -38,7 +38,6 @@ import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.input.TextFieldLineLimits import androidx.compose.foundation.text.input.TextFieldState import androidx.compose.foundation.text.input.clearText @@ -86,8 +85,6 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.platform.LocalClipboard import androidx.compose.ui.res.pluralStringResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.input.ImeAction -import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.PreviewLightDark @@ -714,6 +711,8 @@ private fun QuickChatRow( } } +private const val MAX_LINES = 3 + /** * The text input field for composing messages. * @@ -745,19 +744,12 @@ private fun MessageInput( OutlinedTextField( modifier = modifier.fillMaxWidth().padding(horizontal = 8.dp, vertical = 4.dp), state = textFieldState, - lineLimits = TextFieldLineLimits.SingleLine, + lineLimits = TextFieldLineLimits.MultiLine(1, MAX_LINES), label = { Text(stringResource(R.string.message_input_label)) }, enabled = isEnabled, shape = RoundedCornerShape(ROUNDED_CORNER_PERCENT.toFloat()), isError = isOverLimit, placeholder = { Text(stringResource(R.string.type_a_message)) }, - keyboardOptions = - KeyboardOptions(capitalization = KeyboardCapitalization.Sentences, imeAction = ImeAction.Send), - onKeyboardAction = { - if (canSend) { - onSendMessage() - } - }, supportingText = { if (isEnabled) { // Only show supporting text if input is enabled Text(