Skip to content

Commit

Permalink
bugfix: Prevent decomposition of Korean in name field (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
minizzang authored Jan 10, 2024
1 parent 028d42d commit f6ad0fc
Showing 1 changed file with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,25 @@ fun TextFieldAlertDialog(
value = textFieldValue,
onValueChange = { newValue ->
textFieldValue = if (outlinedInputParameters.maxLength != null) {
TextFieldValue(
text = newValue.text.substring(
0,
min(
newValue.text.length,
outlinedInputParameters.maxLength
)
),
selection = TextRange(newValue.text.length)
val trimmedText = newValue.text.substring(
0,
min(
newValue.text.length,
outlinedInputParameters.maxLength
)
)
if (newValue.composition != null) {
TextFieldValue(
text = trimmedText,
selection = TextRange(newValue.selection.start),
composition = newValue.composition
)
} else {
TextFieldValue(
text = trimmedText,
selection = TextRange(newValue.text.length)
)
}
} else {
newValue
}
Expand Down

0 comments on commit f6ad0fc

Please sign in to comment.