From 4fe80ba7a5bc7044421e63d8d855d25418c0ead7 Mon Sep 17 00:00:00 2001 From: Nathanael Maher Date: Sun, 31 May 2026 17:37:21 -0400 Subject: [PATCH] fix: bookmark percentage always 0% and page number starts at 0 (#2188) ## Summary * Fix the issue described in #2176 where bookmark percentages are always 0% * Also fixed the page number rendering to +1 because they are 0 index based, but should be rendered starting from 1 --- ### AI Usage Did you use AI tools to help write this code? _**< NO >**_ --- src/activities/reader/EpubReaderBookmarksActivity.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/activities/reader/EpubReaderBookmarksActivity.cpp b/src/activities/reader/EpubReaderBookmarksActivity.cpp index 617b3c17..fab839e7 100644 --- a/src/activities/reader/EpubReaderBookmarksActivity.cpp +++ b/src/activities/reader/EpubReaderBookmarksActivity.cpp @@ -186,7 +186,8 @@ void EpubReaderBookmarksActivity::render(RenderLock&&) { auto bookmark = bookmarks.at(confirmingDelete >= DELETE_MODE_DISPLAY ? selectorIndex : index); auto tocIndex = epub->getTocIndexForSpineIndex(bookmark.computedSpineIndex); auto tocTitle = (tocIndex >= 0) ? (epub->getTocItem(tocIndex)).title : tr(STR_UNNAMED); - return std::to_string((int)bookmark.percentage) + "% - " + std::to_string(bookmark.computedChapterProgress) + "/" + + return std::to_string((int)(std::clamp(bookmark.percentage, 0.0f, 1.0f) * 100.0f + 0.5f)) + "% - " + + std::to_string(bookmark.computedChapterProgress + 1) + "/" + std::to_string(bookmark.computedChapterPageCount) + " - " + tocTitle; }; const auto getBookmarkIcon = [isPortrait](int index) {