Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Feb 10, 2025
1 parent ce991dc commit f1abcc5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import io.legado.app.ui.book.read.page.entities.PageDirection
import io.legado.app.ui.book.read.page.entities.TextChapter
import io.legado.app.ui.book.read.page.entities.TextPage
import io.legado.app.ui.book.read.page.entities.TextPos
import io.legado.app.ui.book.read.page.entities.column.TextColumn
import io.legado.app.ui.book.read.page.provider.ChapterProvider
import io.legado.app.ui.book.read.page.provider.LayoutProgressListener
import io.legado.app.ui.book.read.page.provider.TextPageFactory
Expand Down Expand Up @@ -357,7 +358,7 @@ class ReadView(context: Context, attrs: AttributeSet) :
var ci = 0
for (index in lineStart..lineEnd) {
val textLine = page.getLine(index)
for (j in 0 until textLine.charSize) {
for (j in textLine.columns.indices) {
if (ci == start) {
startPos.lineIndex = index
startPos.columnIndex = j
Expand All @@ -366,7 +367,12 @@ class ReadView(context: Context, attrs: AttributeSet) :
endPos.columnIndex = j
return@run
}
ci++
val column = textLine.getColumn(j)
if (column is TextColumn) {
ci += column.charData.length
} else {
ci++
}
}
}
}
Expand Down

0 comments on commit f1abcc5

Please sign in to comment.