Skip to content

Commit

Permalink
dont convert to string every time
Browse files Browse the repository at this point in the history
  • Loading branch information
Wavesonics committed Nov 17, 2024
1 parent 1353526 commit e9a772d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fun SpellCheckContent() {
// This is a very naive algorithm that just removes all spell check spans and
// reruns the entire spell check again
richTextState.textChanges.debounceUntilQuiescent(1.seconds).collect { updated ->
val newTextHash = updated.toText().hashCode()
val newTextHash = updated.annotatedString.hashCode()
if (lastTextHash != newTextHash) {
// Remove all existing spell checks
richTextState.getAllRichSpans()
Expand Down Expand Up @@ -206,7 +206,7 @@ fun SpellCheckContent() {
}
}

fun String.getWords(): Sequence<Pair<String, TextRange>> {
private fun String.getWords(): Sequence<Pair<String, TextRange>> {
return sequence {
var startIndex = -1
for (i in indices) {
Expand Down

0 comments on commit e9a772d

Please sign in to comment.