Skip to content

feat/platform keybindings#105

Merged
Razee4315 merged 3 commits into
Razee4315:mainfrom
techie-monk0:feat/platform-keybindings
Jul 14, 2026
Merged

feat/platform keybindings#105
Razee4315 merged 3 commits into
Razee4315:mainfrom
techie-monk0:feat/platform-keybindings

Conversation

@techie-monk0

Copy link
Copy Markdown
Contributor
  • fix(deps): resolve known npm vulnerabilities
  • feat(keybindings): central platform-aware config + Edit menu
  • refactor(find): one find mechanism for editor and reader modes

@Razee4315

Copy link
Copy Markdown
Owner

Hi @techie-monk0
I have made some changes to the code. Could you please check them? There are also some conflicts in the PR, so it would be best if you could fix them and submit the PR again.

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.
@techie-monk0 techie-monk0 force-pushed the feat/platform-keybindings branch from c5dba52 to bfedbe7 Compare July 13, 2026 01:45
@techie-monk0

Copy link
Copy Markdown
Contributor Author

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.

@Razee4315 Razee4315 merged commit e906e3a into Razee4315:main Jul 14, 2026
7 checks passed
@Razee4315

Copy link
Copy Markdown
Owner

Thank you @techie-monk0
merged 🙌...

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