mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
## Summary * **What is the goal of this PR?** Fixes a bug where text disappears after approximately 25 pages in long chapters during EPUB indexing. * **What changes are included?** - Removed the `MAX_LINES = 1000` hard limit in `ParsedText::computeLineBreaks()` - Added safer infinite loop prevention by checking if `nextBreakIndex <= currentWordIndex` and forcing advancement by one word when stuck ## Additional Context * **Root cause:** The `MAX_LINES = 1000` limit was introduced to prevent infinite loops, but it truncates content in long chapters. For example, a 93KB chapter that generates ~242 pages (~9,680 lines) gets cut off at ~1000 lines, causing blank pages after page 25-27. * **Solution approach:** Instead of a hard line limit, I now detect when the line break algorithm gets stuck (when `nextBreakIndex` doesn't advance) and force progress by moving one word at a time. This preserves the infinite loop protection while allowing all content to be rendered. * **Testing:** Verified with a Korean EPUB containing a 93KB chapter - all 242 pages now render correctly without text disappearing. |
||
|---|---|---|
| .. | ||
| Epub | ||
| Epub.cpp | ||
| Epub.h | ||