feat(input): browser editing + zoom shortcuts (⌘C/X/V/A/Z, ⌘+/-/0) for the OSR webview#19
Merged
Merged
Conversation
…r the OSR webview In off-screen-rendering mode there's no AppKit responder chain, so a raw ⌘-key event never becomes an editor action or a zoom — a focused CefWebView couldn't copy/paste/select-all or zoom like a real browser (the #1 nit reported for webviews in Campus). Wire the standard shortcuts to explicit commands: - Native (main.mm): kOpEditCommand → DoEditCommand runs a focused-frame edit command via CefFrame::Copy/Cut/Paste/SelectAll/Undo/Redo (no-ops when nothing is focused/selected). Zoom reuses the existing kOpSetZoom. - Plugin (Swift + Dart): editCommand op + CefWebController.copy/cut/paste/selectAll/undo/redo; setZoomLevel already existed. - CefWebView._onKeyEvent: intercept ⌘C/X/V/A/Z + ⌘⇧Z → the edit commands, and ⌘=/-/0 → a tracked content-zoom level (1.2^level steps, clamped ~48%..207%). Editing on key-down; zoom repeat-friendly. The ⌘/⇧ modifier keydowns still forward to the page (a browser fires keydown for them); the shortcut letter itself is consumed. - Protocol version bumped 1 → 2 (new inbound op); the handshake refuses a mismatched host, so this ships with a republished host + atomic consumer pin bump. Tests: 9 new widget tests drive the real focus/key path and assert the channel calls (⌘C→editCommand(0) … ⌘0→setZoomLevel(0)); full suite 141 green; analyze clean. Native CefFrame edit commands are the canonical CEF-OSR approach (not unit-testable here) — validated live in Campus. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In OSR mode there's no AppKit responder chain, so a raw ⌘-key never becomes an editor action or zoom — a focused
CefWebViewcouldn't copy/paste/select-all or zoom like a real browser. This wires the standard shortcuts.Layers
main.mm):kOpEditCommand→DoEditCommandrunsCefFrame::Copy/Cut/Paste/SelectAll/Undo/Redoon the focused frame (no-op when nothing's focused). Zoom reuseskOpSetZoom.editCommandop +CefWebController.copy/cut/paste/selectAll/undo/redo.CefWebView._onKeyEvent: intercepts ⌘C/X/V/A/Z + ⌘⇧Z → edit commands, and ⌘=/-/0 → tracked content zoom (1.2^level, clamped ~48–207%). The ⌘/⇧ modifiers still forward to the page (browsers fire keydown for them); the shortcut letter is consumed.Tests
9 new widget tests drive the real focus/key path and assert the channel calls (
⌘C → editCommand(0)…⌘0 → setZoomLevel(0)). Full suite 141 green, analyze clean. The nativeCefFrameedit commands are the canonical CEF-OSR approach (not unit-testable here) — validated live in Campus.Follow-up (not here): ⌘F find-in-page (the
findop already exists; needs a small find UI).🤖 Generated with Claude Code