mirror of
https://github.com/readest/readest.git
synced 2026-11-29 19:02:28 +00:00
* feat(reader): search select * refactor(reader): moved select into view * feat: added tests for select logic * fix: does not select from search, only options * fix: test * fix: CFI validation * fix: code cleaning * Revert "fix: code cleaning" This reverts commit 00c9ec3b78e7f91828e28d9239f366cafddc4743. * Revert "Revert "fix: code cleaning"" This reverts commit 2f85d454de39d3f551594a2fe0eb3c146314cbfe. * Revert "fix: CFI validation" This reverts commit 9ed92a3d9e6be0707513ba873687d54ad7b59d70. * fix: cfi validation * fix: test pt2 * feat(reader): vim-style find to start and extend a selection from the keyboard A keyboard-only reader could act on a selection (Ctrl+H/U/N/D/T/R/C) and adjust it with Shift+Arrows (#4728), but couldn't start one without a mouse (#7281). Vim-style find fills that gap: - `/` opens a command line at the bottom of the book. Enter searches the whole book and selects the first match at or after the current page, wrapping to the first. The line shows the term and `[i/N]` until Esc. - `n` / `Shift+N` jump the selection to the next / previous match. - While a match is selected, h l w b e j k 0 $ ( ) { } extend its moving end and `o` swaps the ends, as in visual mode. The page turns when the moving end leaves it. `y` copies (also added to Copy Selection). - Esc clears the selection and ends it. The search stays live across Ctrl+H, so `/term`, Ctrl+H, `n`, Ctrl+H highlights match after match. None of these keys change meaning unless a find is live: the handlers sit ahead of page navigation and the Notebook in one shortcut listener and fall through otherwise. The sidebar search and Previous/Next Result are unchanged and keep using goTo(); vim find runs its own search so their highlights are left alone. A selection made by view.select(), and the keyboard extending it, opens the toolbar and never runs the instant quick action, until the next pointer press. Jumping to a match clears the last one's selection in another section under the guard the cross-page path uses, so the throttled popup dismiss can't close the new toolbar. Chromium quirks handled: `paragraph` steps keep the caret's x, and a forward selection won't extend back to a line or paragraph boundary, so `}` steps to paragraphboundary and `0`/`{` move a collapsed caret and re-extend. `w`/`e` skip spaces so they land the same with macOS and Windows word steps. This replaces the PR's first approach: the select() wrapper in types/view.ts and its test are removed (foliate's view.select() already selects), and the sidebar result click is back to goTo(). Text objects (iw/is/ip) were left out: a two-key sequence doesn't fit the shortcut config without bare s/p bindings. Verified: - e2e/tests/vim-find.spec.ts (7 tests): 28/28 with --repeat-each 4. Before the feature 5 of 6 failed (no find line); the sidebar test passed. Resetting the navigated mark after the first selection fails "a match never runs the instant quick action, nor does extending it" (Dictionary opens on `e`). Dropping the stale-selection clear fails "n and N step through matches" (the old match stays selected). - dev-web, Chromium: light, dark, e-ink, chrome shown (line sits above the footer); scrolled mode; `}` across a page turns the page; Ctrl+H, n, Ctrl+H made two highlights. - annotation.spec.ts + reading.spec.ts: passed except #6540's "keeps the note bubble on restyle", which also fails 3/3 on main under dev-web. - pnpm test: 1250 files, 15210 tests passed (shortcut tests updated for the new `n` / Shift+N defaults). pnpm lint, format:check: clean. - i18n: 5 new strings added and translated in all 34 locales; nothing else in the locale files changed. - Not run: Windows WebView2 and WebKit (macOS/iOS) word and boundary steps, Firefox web (no sentence/paragraph steps), Tauri builds. Reported by you-gao on GitHub Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Huang Xin <chrox.huang@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| annotation.spec.ts | ||
| import.spec.ts | ||
| library.spec.ts | ||
| reading.spec.ts | ||
| search-history.spec.ts | ||
| vim-find.spec.ts | ||