Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sumatrapdfreader/sumatrapdf
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: sumatrapdfreader/sumatrapdf
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: location
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 3 commits
  • 18 files changed
  • 2 contributors

Commits on Apr 10, 2026

  1. add Location (chapter/page) support for multi-chapter documents

    Define Location struct mirroring mupdf's fz_location. Add chapter-aware
    virtual methods to EngineBase and DocController (ChapterCount,
    ChapterPageCount, LocationFromPageNo, PageNoFromLocation). Implement in
    EngineMupdf using fz_count_chapters/fz_location_from_page_number etc.
    
    For multi-chapter docs (epub/html), toolbar shows page/chapter in the
    edit box and pages-in-chapter/total-chapters as the total. Settings
    persist location as "page/chapter" string, restoring on reopen.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    kjk and claude committed Apr 10, 2026
    Configuration menu
    Copy the full SHA
    9954811 View commit details
    Browse the repository at this point in the history
  2. lazy chapter layout for epub: only layout chapters on demand

    For epub/html documents with multiple chapters, skip fz_count_pages()
    (which lays out all chapters) and instead layout only the initial
    chapter. Subsequent chapters are laid out on demand when navigating
    to them via GoToPage, GoToNextPage, ScrollTo, or TOC links.
    
    Key changes:
    - EngineMupdf: EnsureChapterLoaded() calls fz_count_chapter_pages()
      per chapter, tracks loaded state in chapterPageCounts vector
    - DisplayModel: GrowPagesInfo() grows pagesInfo array + text cache
      when new chapters load, followed by Relayout()
    - pagesInfoCount tracks actual array size independently from
      engine->PageCount() to prevent out-of-bounds access
    - GetPageInfo/PageShown/GetZoomReal/CurrentPageNo handle null for
      pages beyond pagesInfoCount
    - DocumentTextCache::Grow() and auto-grow in HasTextForPage/
      GetTextForPage for render thread safety
    - SetChapterMediaboxes uses stored layout dimensions instead of
      fz_load_page to avoid epub HTML cache eviction races
    - Thread safety: EnsureChapterLoaded holds ctxAccess, RenderPage
      and ExtractPageText hold ctxAccess for entire load+use operation
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    kjk and claude committed Apr 10, 2026
    Configuration menu
    Copy the full SHA
    7c004a3 View commit details
    Browse the repository at this point in the history
  3. fix search in epub: load all chapters before searching

    With lazy chapter loading, TextSearch only knew about pages in loaded
    chapters. Load all chapters at the start of FindThread and update
    nPages/pagesToSkip so search covers the entire document.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    kjk and claude committed Apr 10, 2026
    Configuration menu
    Copy the full SHA
    8ab89d1 View commit details
    Browse the repository at this point in the history
Loading