Skip to content

Commit 1401773

Browse files
committed
Start index was updated
1 parent ce2a3dc commit 1401773

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

socially/src/main/java/com/enofeb/socially/view/SocialTextView.kt

+2-4
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ class SocialTextView @JvmOverloads constructor(
4141
@ColorInt
4242
private var _webLinkColor = Color.BLUE
4343

44-
private var startIndexOfLink = -1
45-
44+
private var startIndexOfLink = 0
4645

4746
var socialText: CharSequence?
4847
get() = this.text
@@ -135,9 +134,8 @@ class SocialTextView @JvmOverloads constructor(
135134
val words = this.text.split("\\s+".toRegex()).map { word ->
136135
word.replace("""^[,\.]|[,\.]$""".toRegex(), "")
137136
}
138-
139137
words.forEach { word ->
140-
startIndexOfLink = this.text.toString().indexOf(word, startIndexOfLink + 1)
138+
startIndexOfLink = this.text.toString().indexOf(word)
141139
checkRuleAndSpan(word)
142140
}
143141

0 commit comments

Comments
 (0)