Skip to content

Commit e9a772d

Browse files
committed
dont convert to string every time
1 parent 1353526 commit e9a772d

File tree

1 file changed

+2
-2
lines changed
  • sample/common/src/commonMain/kotlin/com/mohamedrejeb/richeditor/sample/common/spellcheck

1 file changed

+2
-2
lines changed

sample/common/src/commonMain/kotlin/com/mohamedrejeb/richeditor/sample/common/spellcheck/SpellCheckContent.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fun SpellCheckContent() {
109109
// This is a very naive algorithm that just removes all spell check spans and
110110
// reruns the entire spell check again
111111
richTextState.textChanges.debounceUntilQuiescent(1.seconds).collect { updated ->
112-
val newTextHash = updated.toText().hashCode()
112+
val newTextHash = updated.annotatedString.hashCode()
113113
if (lastTextHash != newTextHash) {
114114
// Remove all existing spell checks
115115
richTextState.getAllRichSpans()
@@ -206,7 +206,7 @@ fun SpellCheckContent() {
206206
}
207207
}
208208

209-
fun String.getWords(): Sequence<Pair<String, TextRange>> {
209+
private fun String.getWords(): Sequence<Pair<String, TextRange>> {
210210
return sequence {
211211
var startIndex = -1
212212
for (i in indices) {

0 commit comments

Comments
 (0)