kyle-n / HighlightedTextEditor

A SwiftUI view for dynamically highlighting user input
MIT License
726 stars 69 forks source link

Duplicates text when used with predictive text in iOS 17 #75

Closed ejbills closed 9 months ago

ejbills commented 10 months ago

DO NOT DELETE THIS TEMPLATE

If you do not fill out this template, your issue will be automatically closed.

Describe the bug A clear and concise description of what the bug is. When using this on iOS 17 with predictive text, the text duplicates itself. This makes typing within the editor impossible, disabling predictive text fixes this issue.

To Reproduce Run it in an iOS 17 app environment and type in it.

Expected behavior Normal functions, no duplication of text.

Screenshots If applicable, add screenshots to help explain your problem.

Environment Please include:

Additional context Add any other context about the problem here.

kyle-n commented 10 months ago

Thanks for reporting this. Seems like a big deal, since probably everyone leaves predictive text on. I'll look into it.

kyle-n commented 10 months ago

@ejbills I couldn't reproduce this issue.

This is the code I tried using on iOS 17.1.2. Predictive text did not cause any text to be duplicated.

struct MarkdownEditorA: View {
    @State var text: String = "Test"

    var body: some View {
        HighlightedTextEditor(text: $text, highlightRules: .markdown)
    }
}

https://github.com/kyle-n/HighlightedTextEditor/assets/13384477/4bb655d5-4f59-47b9-a97a-81c8a1d29935

Could you post a SwiftUI snippet that causes the issue, as well as what version of iOS your app is running on? Maybe a screen recording of the issue happening?

kyle-n commented 9 months ago

@ejbills Could you post a SwiftUI snippet that causes the issue, as well as what version of iOS your app is running on? Maybe a screen recording of the issue happening?