Skip to content

feat: show whole-book reading progress percentage in status bar#108

Open
AnnTreenite wants to merge 1 commit intobigbag:mainfrom
AnnTreenite:feat/book-progress
Open

feat: show whole-book reading progress percentage in status bar#108
AnnTreenite wants to merge 1 commit intobigbag:mainfrom
AnnTreenite:feat/book-progress

Conversation

@AnnTreenite
Copy link
Copy Markdown

Replaces the per-chapter page number in the bottom-right of the status bar with a whole-book reading progress percentage (e.g. 87.3%). Progress is calculated from uncompressed byte sizes of each EPUB spine item stored in book.bin - available immediately on first open, no background caching needed. Cache version bumped 6->7 (auto-rebuilt on first open). Approach equivalent to Epub::calculateProgress() from the CrossInk fork, adapted to papyrix-reader architecture.

Replace the per-chapter page counter in the status bar with a whole-book
reading progress percentage (e.g. 87.3%) shown at bottom-right.

For EPUB, each spine section has its own page cache. Page counts are
accumulated in a lightweight index file (spine_pages.bin) stored alongside
the section caches. The index is loaded at book-open and updated in the
background whenever a new section is fully cached, so:
- First open: shows --.-% until the current section is indexed (~seconds)
- Subsequent opens: shows the exact percentage immediately for all
  previously cached sections

For flat formats (TXT, Markdown, FB2, HTML) the percentage is computed
directly from the single-section page cache and is always exact.

XTC format already has a flat page index and is handled by the flat-format
path via currentSectionPage_ / totalPages.
@bigbag
Copy link
Copy Markdown
Owner

bigbag commented Apr 29, 2026

Hey, thanks for the PR!
Two issues though — the description says byte-size progress with cache version 6→7, but the code actually stores lazy page counts in a new spine_pages.bin and leaves BookMetadataCache untouched.
And more fundamentally, whole-book page-count progress isn't really workable with our current cache: pages are built on demand in chunks of 5, and only rendering knows a spine's real page count — so we can't know the book's total without rendering everything first. Right now updateSpinePageCount() doesn't check isPartial(), so most spines get persisted as 5, and the denominator only sums visited spines — the % ends up being noise, and mid-book resume shows --.-%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants