Skip to content

fix: go to prev page on the first one, get teleported to the end of book#970

Merged
daveallie merged 1 commit intocrosspoint-reader:masterfrom
mrtnvgr:book-wrap-fix
Feb 19, 2026
Merged

fix: go to prev page on the first one, get teleported to the end of book#970
daveallie merged 1 commit intocrosspoint-reader:masterfrom
mrtnvgr:book-wrap-fix

Conversation

@mrtnvgr
Copy link
Contributor

@mrtnvgr mrtnvgr commented Feb 18, 2026

Summary

  1. Go to the first page in a .epub file.
  2. Hit Up button
  3. Get teleported to the last page :)

TxtRenderActivity seems to have this if check, but EPUB one does not.


AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

No actionable comments were generated in the recent review. 🎉

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ec5fc5 and 6ed2390.

📒 Files selected for processing (1)
  • src/activities/reader/EpubReaderActivity.cpp
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Levrk
Repo: crosspoint-reader/crosspoint-reader PR: 909
File: src/activities/reader/EpubReaderActivity.cpp:461-461
Timestamp: 2026-02-16T20:43:19.339Z
Learning: In src/activities/reader/EpubReaderActivity.cpp, when using ConfirmationActivity with enterNewActivity(), it's not necessary to call exitActivity() beforehand. The ConfirmationActivity operates as a modal dialog and cleanup is handled via the pendingSubactivityExit flag in the callback lambda. This differs from other activities like EpubReaderChapterSelectionActivity or KOReaderSyncActivity which do require exitActivity() before enterNewActivity().
📚 Learning: 2026-02-16T20:43:19.339Z
Learnt from: Levrk
Repo: crosspoint-reader/crosspoint-reader PR: 909
File: src/activities/reader/EpubReaderActivity.cpp:461-461
Timestamp: 2026-02-16T20:43:19.339Z
Learning: In src/activities/reader/EpubReaderActivity.cpp, when using ConfirmationActivity with enterNewActivity(), it's not necessary to call exitActivity() beforehand. The ConfirmationActivity operates as a modal dialog and cleanup is handled via the pendingSubactivityExit flag in the callback lambda. This differs from other activities like EpubReaderChapterSelectionActivity or KOReaderSyncActivity which do require exitActivity() before enterNewActivity().

Applied to files:

  • src/activities/reader/EpubReaderActivity.cpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: cppcheck
  • GitHub Check: build
🔇 Additional comments (1)
src/activities/reader/EpubReaderActivity.cpp (1)

241-253: LGTM! Correct fix for backward cross-spine navigation.

The added else if (currentSpineIndex > 0) branch properly handles the case when the user is at the first page of a non-first spine, enabling navigation to the last page of the previous spine. When at the very beginning of the book (spine 0, page 0), both conditions fail and only requestUpdate() is called, preventing the teleportation bug.

The implementation correctly:

  • Uses nextPageNumber = UINT16_MAX as a sentinel (handled at lines 557-558 to set currentPage to the last page)
  • Acquires RenderLock before resetting the section, consistent with other spine transitions
  • Mirrors the forward navigation pattern at lines 254-267

📝 Walkthrough

Walkthrough

A modification to the backward page navigation in EpubReaderActivity.cpp enables cross-spine navigation by handling the case when a user attempts to navigate backward at the first page of a section, allowing the previous spine to load instead of remaining in place.

Changes

Cohort / File(s) Summary
EPUB Reader Navigation
src/activities/reader/EpubReaderActivity.cpp
Added logic to handle page-back navigation at the start of a section; when currentPage is 0 and currentSpineIndex > 0, the code now decrements the spine index, resets the section, acquires the render lock, and updates the page to enable cross-spine backward navigation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the bug fix: preventing navigation beyond the first page of an EPUB book by adding cross-spine backward navigation.
Description check ✅ Passed The description clearly documents the bug (teleporting to end of book when pressing Up on first page) and the solution (implementing the same check as TxtRenderActivity).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@daveallie daveallie merged commit 10b7769 into crosspoint-reader:master Feb 19, 2026
7 checks passed
@mrtnvgr mrtnvgr deleted the book-wrap-fix branch February 19, 2026 11:01
saslv pushed a commit to saslv/crosspoint-reader that referenced this pull request Feb 19, 2026
…ook (crosspoint-reader#970)

## Summary

1. Go to the first page in a .epub file.
2. Hit `Up` button
3. Get teleported to the last page :)

`TxtRenderActivity` seems to have this if check, but EPUB one does not.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**NO**_
el pushed a commit to el/crosspoint-reader that referenced this pull request Feb 19, 2026
…ook (crosspoint-reader#970)

## Summary

1. Go to the first page in a .epub file.
2. Hit `Up` button
3. Get teleported to the last page :)

`TxtRenderActivity` seems to have this if check, but EPUB one does not.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**NO**_
lukestein pushed a commit to lukestein/crosspoint-reader that referenced this pull request Feb 20, 2026
…ook (crosspoint-reader#970)

## Summary

1. Go to the first page in a .epub file.
2. Hit `Up` button
3. Get teleported to the last page :)

`TxtRenderActivity` seems to have this if check, but EPUB one does not.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**NO**_
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