feat/platform keybindings#105
Conversation
techie-monk0
commented
Jul 11, 2026
- fix(deps): resolve known npm vulnerabilities
- feat(keybindings): central platform-aware config + Edit menu
- refactor(find): one find mechanism for editor and reader modes
|
Hi @techie-monk0 Thank you! |
Route every shortcut through one config (src/config/keybindings.ts) instead of scattered hardcoded ctrlKey checks, so the primary modifier resolves to Cmd on macOS and Ctrl on Windows/Linux — the shortcuts are now Mac-native. The cheatsheet, title-bar tooltips, command-palette hints, and the CodeMirror editor keymap all derive their combos from the same source, so nothing can drift from what the handler actually listens for. Add an Edit menu in the title bar (Find / Find & Replace / Find in Files) that dispatches through the same config. Tab cycling stays a literal Ctrl everywhere because Cmd+Tab is the macOS app-switcher.
Cmd-F had two separate implementations — a CodeMirror find/replace bar over the source text, and a CSS-Highlight-API bar over the rendered preview. They looked and behaved differently, and the preview one flashed every partial query as you typed (searching "of" lit up every "o" first). Collapse them into a single FindBar component driving a small FindController interface, with two thin adapters: the editor (findReplace.ts + CodeMirror decorations) and the preview (CSS Custom Highlight API). Both surfaces now share one look and behaviour: - 400ms debounce, and only the settled query is ever searched - previous highlights clear the instant the query changes - every match is highlighted with the active one emphasised (the editor previously only moved the selection) Reader mode stays find-only; replace and regex remain source-text only.
The find-bar focus-steal regression test (added upstream as FindReplaceBar.test.tsx) drives CodeEditor's find flow, which the find refactor consolidated into FindBar. FindReplaceBar.tsx no longer exists, so rename the file and its describe block to match. Test logic unchanged; still passes against the new FindBar.
c5dba52 to
bfedbe7
Compare
|
Rebased onto latest main (v1.0.49) to resolve conflicts. Summary of how I handled the overlaps: Find focus fix — we converged. Your 39c2b7c (drop view.focus() in handleFindJump) targets the same bug my find refactor addresses. In the consolidated FindBar, the editor adapter navigates matches with decoration effects + scrollIntoView and never calls view.focus() or moves the document selection, so focus stays in the find input the whole time. To prove I didn't regress your fix, I kept your regression test: it now drives the new FindBar through CodeEditor and passes unchanged. I renamed the file FindReplaceBar.test.tsx → FindBar.focus.test.tsx and updated its describe label, since FindReplaceBar.tsx no longer exists (test logic is untouched). Conflict in CodeEditor.tsx was at handleFindJump, which this PR removes in favor of the shared FindController adapter — resolved by taking the refactor's version. No other source conflicts. Dropped my fix(deps) commit that was riding along on this branch — your #100 supply-chain work already covers it, and main is now on newer versions (astro 6, codemirror-state 6.7, vite 7), so keeping mine would've been a downgrade. One note for a separate deps pass whenever convenient: my dropped commit had overrides for esbuild, js-yaml, and tar that aren't in the current override block — worth a look if those transitive advisories are still open, but they don't belong in this PR. Verification: tsc clean, full suite green (280/280) after a fresh build. |
|
Thank you @techie-monk0 |