Fixes #3830 - Editing messages not placing the cursor at the end of the text

This commit is contained in:
Stefan Ceriu 2025-02-26 08:34:39 +02:00 committed by Stefan Ceriu
parent 1bc3723c34
commit fb8d69dd92

View File

@ -139,10 +139,16 @@ private struct UITextViewWrapper: UIViewRepresentable {
// https://github.com/element-hq/element-x-ios/issues/3104
textView.selectedTextRange = selection
} else {
// Re-setting the selected range is important when inserting pills
// but we need to not do that when entering edit mode, where the
// cursor needs to stay at the end of the text
// https://github.com/element-hq/element-x-ios/issues/3830
if textView.selectedRange.location != text.length {
textView.selectedRange = selectedRange
}
}
}
}
func makeCoordinator() -> Coordinator {
Coordinator(text: $text,