-
Notifications
You must be signed in to change notification settings - Fork 1
TXT chapter mode: progress bar shows book progress instead of chapter progress #31
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug
Severity: Medium
Repro
- Open a TXT file that has detected chapters (WI-6 chapter-based mode)
- Navigate to any chapter
- Observe the ReadingProgressBar scrubber and progress percentage
Expected
Progress bar reflects position within the current chapter (0-100%).
Actual
Progress bar shows position relative to the whole book.
Root cause
currentOffsetUTF16 in TXTReaderViewModel is dual-purpose — set to a global offset by navigateToChapter() but overwritten with local (chapter-relative) offsets by the bridge's scroll callbacks. The onChange handler in TXTReaderContainerView that feeds chapterScrollFraction can't reliably distinguish them.
Attempted fixes
- Normalize offset by subtracting
chapter.globalStartUTF16when offset >= globalStart - Still unreliable due to dual-purpose
currentOffsetUTF16
Proper fix needed
Separate currentOffsetUTF16 (global, for persistence) from a chapter-local scroll fraction reported directly by the bridge.
Files
vreader/Views/Reader/TXTReaderContainerView.swift— progress bar wiringvreader/ViewModels/TXTReaderViewModel.swift—currentOffsetUTF16,navigateToChapter()vreader/Views/Reader/TXTTextViewBridgeCoordinator.swift— scroll callbacks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working