From 94bdfc09ef5f6b9bd8bee080a7425b89824a66fd Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Mon, 19 Sep 2022 13:47:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/page/entities/TextPage.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt index 620b18bc9..69899d87c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt @@ -149,7 +149,8 @@ data class TextPage( removePageAloudSpan() var lineStart = 0 for ((index, textLine) in textLines.withIndex()) { - if (aloudSpanStart > lineStart && aloudSpanStart < lineStart + textLine.text.length) { + val lineLength = textLine.text.length + if (textLine.isParagraphEnd) 1 else 0 + if (aloudSpanStart > lineStart && aloudSpanStart < lineStart + lineLength) { for (i in index - 1 downTo 0) { if (textLines[i].isParagraphEnd) { break @@ -167,7 +168,7 @@ data class TextPage( } break } - lineStart += textLine.text.length + lineStart += lineLength } }