Skip to content

Keep selections on the page, keep search matches in view, and clear the phone footer - #10

Merged
Mischou01 merged 1 commit into
mainfrom
claude/selection-text-display-bugs-anh4fo
Oct 26, 2026
Merged

Mischou01 merged 1 commit into
mainfrom
claude/selection-text-display-bugs-anh4fo

Conversation

@Mischou01

Copy link
Copy Markdown
Owner

What changes

Selections stay on the page (paginated text)

  • foliate-js turned the page when a drag selection (or a long press's handles) was held past the page edge, so a selection could run on across pages. A captured selectionchange listener in BookView now runs before foliate's, stops it, and trims the selection to the text on the page or spread showing (trimToPage in the new src/reader/pageSelection.ts).
  • Ctrl+A now selects the page instead of the whole chapter.
  • Shift+arrow keys no longer turn the page, since they extend a selection.
  • Scrolled mode is unchanged: dragging past the edge still scrolls, as anywhere else.

Search results stay findable after the sheet closes

  • On the desktop, closing the search sheet widens the text and can switch it from one column to two. The match's outline was cleared at the same moment, so the passage was easy to lose.
  • The result gone to now gets its own mark (BookViewHandle.showMatch). The mark survives the sheet closing and goes away when the reader turns the page, navigates elsewhere or searches again.
  • After a relayout, if the page showing doesn't contain the match, the view goes back to it.

Phone footer

  • "x min left in chapter" and the page count were drawn over the last line of text with nothing behind them. On phones the footer now has the page colour behind it, with a short fade at the top, and fits on one line.

Smaller fixes

  • foliate sometimes reports a relocation with a NaN fraction before a section is laid out. That set the footer's progress slider to NaN and could be saved as progress. Such relocations are now skipped.
  • Clicking the read-aloud or search mark used to swallow the tap; it now counts as a normal tap.
  • Taking either mark off used to delete a highlight on exactly the same text from the page; that highlight now comes back.

Testing

  • bun run check passes: types, lint, formatting and tests, including six new tests for trimToPage.
  • I ran the reader in headless Chromium, with the Tauri core mocked, at desktop and Pixel 7 sizes:
    • A drag held past the page corner stayed on page 1 (it used to turn to page 3).
    • Ctrl+A and Shift+Down stayed on the page.
    • 12 search results, with two-page spreads at 1700px wide, were all on screen and marked after the sheet closed. The mark was gone after a page turn.
    • The phone footer no longer overlaps the text.
    • The NaN warning no longer appears.
  • Not covered: WebKitGTK, which the Linux desktop app uses. I couldn't reproduce the reported jump to the next page in Chromium. The check-and-go-back after relayout is meant to cover it, so please confirm it on Linux.

Generated by Claude Code

…he phone footer

- A selection in paginated text stays on the page showing. foliate turned the page when a
  drag (or a long press's handles) held past its edge, and Ctrl+A selected the whole chapter;
  both now stop at the page. Shift+arrow keys extend a selection instead of turning pages.
- A search result gone to stays marked after the search closes, until the reader turns the
  page. Closing the sheet relays the text (one column to two, say), and the outline went with
  it, so the match was easy to lose; if the new layout lands off the match, it's gone to again.
- On phones the footer (time and pages left in the chapter) has the page behind it and fits on
  one line, instead of printing over the last line of text.
- Relocations that foliate reports before a section is laid out, with no fraction, are skipped,
  so the progress bar and saved progress never get NaN.
- Clicking a read-aloud or search mark counts as a tap rather than being swallowed, and taking
  either mark off brings back a highlight it covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011d6aBsdw5zNEaRoJx1ciHF
@Mischou01
Mischou01 merged commit 2062430 into main Oct 26, 2026
6 checks passed
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