TextField's maxLines is ignored when pasting text
Here goes a weird issue: When a TextField has a maxLines limit you simply can't add new lines by hitting the enter key. However, you can copy and paste a text with multiple lines. The weird part here is that it seems that everything is pasted in a single line which has it's own "scroll".
It's easier to understand with some GIFs.
Example without maxLines (works nicely):

Example with maxLines = 1 (weird behavior):

Taking Intellij IDEA as an example of how it should behave (I've tried with a couple of random fields), if (pastedTextLines) > (maxLines - currentLineNumber) the last line should contain all the "overflowing" lines in a single one by removing the new lines character (not sure if it's possible to keep it while still having it in a single line).
Test code:
var textFieldValue by remember { mutableStateOf("") }
MaterialTheme {
Column {
OutlinedTextField(
value = textFieldValue,
onValueChange = {
textFieldValue = it
},
modifier = Modifier.size(200.dp),
maxLines = 1,
)
OutlinedTextField(
value = textFieldValue,
onValueChange = {
textFieldValue = it
},
maxLines = 1,
)
}
}
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.