From a382341ac51f12a3ac0455836f96d5acf3efc3a3 Mon Sep 17 00:00:00 2001 From: Justin Mitchell Date: Sun, 4 Jan 2026 23:52:25 -0500 Subject: [PATCH] fixes pushes progress --- lib/KOReaderSync/ProgressMapper.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/KOReaderSync/ProgressMapper.cpp b/lib/KOReaderSync/ProgressMapper.cpp index f4c4f8d9..a1e2b4f7 100644 --- a/lib/KOReaderSync/ProgressMapper.cpp +++ b/lib/KOReaderSync/ProgressMapper.cpp @@ -94,12 +94,9 @@ CrossPointPosition ProgressMapper::toCrossPoint(const std::shared_ptr& epu std::string ProgressMapper::generateXPath(int spineIndex, int pageNumber, int totalPages) { // KOReader uses 1-based DocFragment indices - // Estimate paragraph number based on page position - // Assume ~3 paragraphs per page on average for e-reader screens - constexpr int paragraphsPerPage = 3; - const int estimatedParagraph = (pageNumber * paragraphsPerPage) + 1; // 1-based - - return "/body/DocFragment[" + std::to_string(spineIndex + 1) + "]/body/p[" + std::to_string(estimatedParagraph) + "]"; + // Use a simple xpath pointing to the DocFragment - KOReader will use the percentage for fine positioning + // Avoid specifying paragraph numbers as they may not exist in the target document + return "/body/DocFragment[" + std::to_string(spineIndex + 1) + "]/body"; } int ProgressMapper::parseDocFragmentIndex(const std::string& xpath) {