diff --git a/USER_GUIDE.md b/USER_GUIDE.md index 037b6504..5db05cae 100644 --- a/USER_GUIDE.md +++ b/USER_GUIDE.md @@ -527,6 +527,8 @@ On the **Xteink X3**, the gyroscope can be used to turn pages by tilting the dev When reading an EPUB that contains footnotes, you can navigate to the footnote text by selecting the footnote reference in the book. From the footnote, you can return to your original reading position. +If the device goes to sleep or you close the book while viewing a footnote, the book reopens to your original reading position, not the footnote. + ### System Navigation * **Return to Home:** Press the **Back** button to close the book and return to the **[Home](#31-home-screen)** screen. diff --git a/src/activities/reader/EpubReaderActivity.cpp b/src/activities/reader/EpubReaderActivity.cpp index bbb73eb1..59d189a8 100644 --- a/src/activities/reader/EpubReaderActivity.cpp +++ b/src/activities/reader/EpubReaderActivity.cpp @@ -177,6 +177,14 @@ void EpubReaderActivity::onExit() { APP_STATE.readerActivityLoadCount = 0; APP_STATE.saveToFile(); + + // Leaving mid-footnote loses the in-RAM return stack on deep sleep; persist the + // pre-footnote position so the book reopens at the link origin, not the footnote. + if (footnoteDepth > 0 && epub) { + const SavedPosition& origin = savedPositions[0]; + saveProgress(origin.spineIndex, origin.pageNumber, 0); + } + section.reset(); if (pendingReadFolderMove && epub) { const std::string srcPath = epub->getPath();