Add right-click context menu in the editor buffer (#315)#2308
Open
sinelaw wants to merge 1 commit into
Open
Conversation
Right-clicking inside a text-buffer split previously did nothing: the mouse handler only raised context menus for tabs, the file explorer, and the orchestrator dock. Users coming from VS Code and other editors expect a plain right-click to surface the common clipboard verbs. Add an editor context menu offering Cut / Copy / Paste / Select All. It mirrors the existing FileExplorerContextMenu/TabContextMenu machinery for state, rendering, keyboard navigation (Up/Down/Enter/Esc), mouse hover-highlight, and click-to-activate. Each item dispatches the corresponding editor Action, so all existing routing (read-only buffers, focused widgets, composite buffers) is reused unchanged. Right-clicking a split focuses it first so the clipboard action targets the buffer the user clicked. Terminal splits are left untouched so they keep their own mouse semantics (e.g. Shift+Right-Click paste passthrough). Adds an e2e test that drives real mouse/keyboard events and asserts on rendered output, plus editor.context.* locale keys for all 14 locales.
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.
Summary
Closes #315.
Right-clicking inside a text-buffer split previously did nothing — the mouse handler only raised context menus for tabs, the file explorer, and the orchestrator dock. The requester asked for a VS Code-style right-click menu in the editor (without Shift, which today just triggers terminal paste passthrough).
This adds an editor context menu offering the universal clipboard verbs:
It deliberately stays minimal — the command palette (
Ctrl+P) already covers the long tail of commands; this is just the muscle-memory right-click surface.Design
FileExplorerContextMenu/TabContextMenumachinery for state, rendering, keyboard navigation (Up/Down/Enter/Esc), mouse hover-highlight, and click-to-activate. NewEditorContextMenutype inapp/types/context_menu.rs.Action(Cut/Copy/Paste/SelectAll), so all existing routing is reused unchanged — read-only buffers, focused text-widget inputs, composite buffers, the internal/system clipboard split, etc.Testing
tests/e2e/editor_context_menu.rs(12 cases) drives real mouse/keyboard events through the samehandle_mouse/handle_keypath as production and asserts only on rendered output (per the "observe, not inspect" rule): menu open/close, item rendering, Cut/Copy→Paste/Select All behavior, keyboard nav, hover, terminal/menu-bar exclusion.freshbinary: a right-click renders the menu and clicking Select All highlights the whole buffer and moves the cursor to EOF.cargo check,cargo clippy --all-targets, andcargo fmtare clean for the changed files.editor.context.*locale keys across all 14 locales.Generated by Claude Code