Skip to content

chore: Merge upstream - #153

Merged
znelson merged 13 commits into
mainfrom
upstream-merge
Nov 10, 2026
Merged

znelson merged 13 commits into
mainfrom
upstream-merge

Conversation

@znelson

@znelson znelson commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Upstream sync

Upstream commits merged:

  • 29c69b3d fix: automatically connect to wifi for clock sync (#2379)
  • 8b9a73a7 chore: update Spanish, Catalan, and Valencian translations (#2383)
  • 370f87ea feat: add Spacing Modifier Letters range to font presets (#2386)
  • d1e4650e fix: don't justify-stretch a leading no-break space (#2185) (#2387)
  • 282514f7 fix(epub): flush displaced anchor before overwrite (#2336) (#2390)
  • 0ce874f8 feat: footnote returns to original position on deep sleep (#2392)
  • d1abcc00 feat: render grayscale epub images without text aa (#2393)
  • 362dcb2a feat: Smooth progressive JPEG cover upscales in BMP conversion (#2398)
  • 1db14423 fix: several bookmarks UX improvments (#2372)
  • 9ad2da09 fix: add seven missing hebrew translations (#2409)

Resolutions

  • Bookmarks UX (#2372): semantics ported, model kept. Upstream's toggle-on-repeat (with "Bookmark removed." popup), per-page bookmarked flag, statusbar indicator, and menu TOGGLE_BOOKMARK action are adopted - but re-expressed on our identity-based BookmarkStore (spineIndex/paragraphIndex/liIndex) instead of their xpath/percentage JSON model. Their whole-entry RAM cache became a 6-byte-per-entry identity-key cache (same goal: no SD reads on page turns). Their JSON save/load, xpath matchers, progress-epsilon helpers, and the STR_HOLD_OPEN_TO_DELETE rename were dropped; the bookmarks list activity stays ours.
  • Clock sync WiFi flow (#2379): adopted - offline manual sync now launches the WiFi picker and resumes. Expressed through halWifi (isConnected/disconnect/stop) and our silentRestart() teardown pattern instead of raw WiFi.* calls.
  • Leading no-break-space justify fix (#2185): the wordIdx > 0 guard applied in all three positioning loops of our relocated ParsedText (reordered/RTL/LTR), our TextAlign and index-indirect forms. Section::FILE_VERSION 29 -> 30 - affected justified lines serialize different positions.
  • Grayscale images without text AA (#2393): adopted; the new page-element filter helper re-expressed on our unique_ptr element vector. The storeBwBuffer failure guard adopted (our API already returned bool).
  • Footnote deep-sleep fix (#2392): adopted onto our savedPositions stack in onExit.
  • Declined again: the long-press-menu setting (default flip rode this span) and auto-page-turn constants - both stay out per manifest.
  • Translations: 13 conflicted locale files taken from upstream and re-normalized; STR_BOOKMARK_REMOVED added to english, OPDS/feed strings excluded.

Follow-up commits on the branch: manifest relocation entries for Page.* plus thirteen rename-detected library moves (fixes walk-tool classification), and a bookmark-indicator fix - indicator/toggle now match by resolved page (same max(paragraph page, list-item page) rule the bookmarks list uses) instead of page-top LUT identity. Equality-on-page-top flagged every page topped by the bookmarked paragraph (one bookmark could flag several consecutive pages), went invisible after relayout (stored tops may top no page in the new layout, making toggle duplicate instead of remove), and cost two SD opens per page render. Resolved-page matching gives one invariant: the page the list jumps to is the page that is flagged is the page a toggle removes.

Verification

  • upstream_sync.py verify passed (host gtest suite 373/373, clang-format, pio run)

uxjulia and others added 13 commits June 20, 2026 22:09
…2379)

## Summary

* **What is the goal of this PR?** 
* Make manual clock sync work even when the device is not already
connected to Wi-Fi, so the user can start the sync flow directly from
settings instead of being blocked by connection state.
* **What changes are included?**
* `ClockSyncActivity` now launches the normal Wi-Fi selection flow
before syncing when the device is offline.
* After Wi-Fi selection succeeds, clock sync resumes automatically and
performs the existing forced NTP sync.
* If clock sync had to bring Wi-Fi up, the activity disconnects and uses
the existing silent restart cleanup path to avoid leaving the device in
a fragmented post-Wi-Fi heap state.
* The completion UI now only advertises Back, matching the updated input
handling.

## Additional Context

* Existing behavior is unchanged when Wi-Fi is already connected: the
activity syncs immediately.
* Cancelling Wi-Fi selection exits the clock sync flow.

---

### 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? _**< YES >**_
…#2336) (crosspoint-reader#2382)

## Summary

* **What is the goal of this PR?** (e.g., Implements the new feature for
file uploading.)

Fixes footnote links landing in start section instead of the specific
foot note target.

* **What changes are included?**

ChapterHtmlSlimParser.cpp: call flushPendingAnchor() before overwriting
pendingAnchorId. First id got lost due to consecutive non-block elements
carry ids, the first id was lost and the reader had no page to jump to,
so it defaulted to page 0.

## Additional Context

Tested with the epubs attached to to crosspoint-reader#2336. Need to clear .crosspoint/
cache after flashing so the anchor map gets rebuilt with the fix.

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks,
  specific areas to focus on).

---

### 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? 

Partially assisted with writing documentation.
## Summary

This PR enhances the EPUB reader's bookmark system with two
complementary improvements: a per-page bookmark indicator icon and
toggle behavior on the existing long-press action.

---

### What Changed

**Bookmark Toggle (was: add-only)**

The long-press Confirm action now toggles bookmarks rather than always
adding. `addBookmark()` checks whether a bookmark with the same xpath
already exists in the in-memory cache:
- If found → removes it and shows "Bookmark removed."
- If not found → adds it and shows "Bookmark added."

A new `STR_BOOKMARK_REMOVED` translation string was added to support the
removal message.

**Bookmark Icon Indicator**

A `BookmarkIcon` is now drawn at the top-right corner of the page
whenever the current page has a bookmark. `updateBookmarkFlag()` is
called at render time to determine whether the current page is
bookmarked.

**In-Memory Bookmark Cache**

Bookmarks are now loaded into `cachedBookmarks` on `onEnter()` rather
than being re-read from disk on every toggle. All subsequent add/remove
operations work against this cache and flush to disk, avoiding redundant
file reads on each bookmark action.

**Faster bookmarks list**

Previously, calculating "page X/Y" for each entry required decompressing
the entire spine item. We now persist `si`/`pc`/`pp` (spine index, page
count, and page progress) in the bookmark JSON when saving, and restore
them when loading. This avoids the expensive `toCrossPoint()` loop in
`onEnter()`, significantly reducing the cost of initializing the
bookmarks list.

---

### Files Changed

- `EpubReaderActivity.cpp` — `addBookmark()` toggle logic,
`updateBookmarkFlag()` (new), icon rendering in `renderContents()`,
cache initialization in `onEnter()`
- `EpubReaderActivity.h` — new fields: `currentPageBookmarked`,
`bookmarkRemoved`, `cachedBookmarks`; new method declaration
`updateBookmarkFlag()`

---

### 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? _**< PARTIALLY >**_

---------

Co-authored-by: Julia Nguyen <julia@uxj.io>
…-merge

# Conflicts:
#	USER_GUIDE.md
#	lib/I18n/translations/catalan.yaml
#	lib/I18n/translations/english.yaml
#	lib/I18n/translations/german.yaml
#	lib/I18n/translations/italian.yaml
#	lib/I18n/translations/russian.yaml
#	lib/I18n/translations/slovak.yaml
#	lib/I18n/translations/spanish.yaml
#	lib/I18n/translations/swedish.yaml
#	lib/I18n/translations/ukrainian.yaml
#	lib/I18n/translations/valencian.yaml
#	lib/I18n/translations/vietnamese.yaml
#	lib/Typesetter/Typesetter/Page.cpp
#	lib/Typesetter/Typesetter/ParsedText.cpp
#	src/CrossPointSettings.h
#	src/JsonSettingsIO.cpp
#	src/activities/reader/EpubReaderActivity.cpp
#	src/activities/reader/EpubReaderBookmarksActivity.cpp
#	src/activities/settings/ClockSyncActivity.cpp
#	src/components/themes/BaseTheme.cpp
Git rename detection carried upstream's lib/Epub/Epub/Page.* changes to
lib/Typesetter/Typesetter/Page.* during the merge, but without manifest
entries the walk tool reported the files as absent from the fork.

chore: Add missing relocations to upstream-sync manifest

Audited against git rename detection between the upstream anchor tree
and the fork (diff -M --diff-filter=R): six whole-library moves
(converters and the BMP converters -> lib/ImageDecoder, hyphenation ->
lib/Hyphenation, JsonParser -> lib/JsonIO, and six small libs flattened
into lib/Utility) plus the Footnotes/PercentSelection activity .cpp
renames were detectable but unlisted, so the walk tool reported their
files as absent from the fork.
…tity

The page-top (paragraph, listItem) LUT identity only matches a bookmark
on the exact page it was added in the exact layout it was added: the
bookmarks list resolves entries to max(paragraph page, list-item page),
so a bookmark whose list item starts below the top of its landing page
rendered as unbookmarked there, and a toggle would duplicate instead of
remove. The same mismatch appeared after any relayout.

Resolve each of the current spine's bookmarks to a page once per spine
load (same max() rule as the list), cache it in the key cache, and
compare pages in RAM. This also removes the two SD file opens per page
render that the per-render LUT derivation cost.

refactor: Use std::optional for bookmark page-resolution tracking

bookmarkPagesResolvedForSpine means 'the spine whose keys carry valid
resolved pages, if any' - express that as std::optional (same idiom as
chapterPageInfo.tocIndex) instead of reusing the PAGE_UNRESOLVED
sentinel, which also aliased a theoretical spine index 0xFFFF. The
per-key resolvedPage keeps the sentinel: widening every cache entry for
an optional buys nothing since it is only read while the member names
the current spine.
@znelson
znelson merged commit a7aa4a4 into main Nov 10, 2026
6 checks passed
@znelson
znelson deleted the upstream-merge branch November 10, 2026 02:19
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.

8 participants