From 47fe2dc4501951c370a41b0e9d4942f3f3c187ec Mon Sep 17 00:00:00 2001 From: shenlei Date: Mon, 6 Jul 2026 11:14:48 +0900 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E8=A1=A8=E5=85=A8=E9=87=8F=E6=8E=A5?= =?UTF-8?q?=E7=AE=A1=E6=94=B9=E4=B8=BA=E6=8C=89=E5=AD=90=E9=9B=86=E8=A6=86?= =?UTF-8?q?=E7=9B=96=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fullReplace 从"候选章节数 >= 当前章节数"改为"候选页表必须覆盖当前窗口 的全部章节",避免跳章后 partial map 数量达标但缺少远端已映射章节时, 全量替换丢弃这些条目导致总页数抖动。 Co-Authored-By: Claude Fable 5 --- .../RDEPUBPageMapReconciliationCoordinator.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Sources/RDReaderView/EPUBUI/ReaderController/RDEPUBPageMapReconciliationCoordinator.swift b/Sources/RDReaderView/EPUBUI/ReaderController/RDEPUBPageMapReconciliationCoordinator.swift index 03b85e8..c601bfe 100644 --- a/Sources/RDReaderView/EPUBUI/ReaderController/RDEPUBPageMapReconciliationCoordinator.swift +++ b/Sources/RDReaderView/EPUBUI/ReaderController/RDEPUBPageMapReconciliationCoordinator.swift @@ -164,6 +164,7 @@ final class RDEPUBPageMapReconciliationCoordinator { lastBuildableSpineIndex: Int ) -> RDEPUBPageMapTakeoverDecision { let candidateIndices = Set(candidatePageMap.entries.map { $0.spineIndex }) + let currentIndices = Set(currentWindow.entries.map { $0.spineIndex }) let currentEntries = currentWindow.entries.count if let currentSpineIndex { @@ -189,8 +190,8 @@ final class RDEPUBPageMapReconciliationCoordinator { } } - let isComplete = candidateIndices.count >= currentEntries - if isComplete { + let coversCurrentWindow = currentIndices.isSubset(of: candidateIndices) + if coversCurrentWindow { RDEPUBBackgroundTrace.log( "Reconciliation", "evaluateFullPageMapTakeover: fullReplace — candidateChapters=\(candidateIndices.count) currentChapters=\(currentEntries) candidatePages=\(candidatePageMap.totalPages) currentPages=\(currentWindow.totalPages)" @@ -198,6 +199,10 @@ final class RDEPUBPageMapReconciliationCoordinator { return .fullReplace(candidatePageMap) } + RDEPUBBackgroundTrace.log( + "Reconciliation", + "evaluateFullPageMapTakeover: keepCurrentWindow — candidate does not cover currentWindow candidateChapters=\(candidateIndices.count) currentChapters=\(currentEntries)" + ) return .keepCurrentWindow }