Skip to content

Add right-click context menu in the editor buffer (#315)#2308

Open
sinelaw wants to merge 1 commit into
masterfrom
claude/peaceful-goodall-kejbye
Open

Add right-click context menu in the editor buffer (#315)#2308
sinelaw wants to merge 1 commit into
masterfrom
claude/peaceful-goodall-kejbye

Conversation

@sinelaw

@sinelaw sinelaw commented Jun 10, 2026

Copy link
Copy Markdown
Owner

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:

┌──────────────────┐
│ Cut              │
│ Copy             │
│ Paste            │
│ Select All       │
└──────────────────┘

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

  • Mirrors the existing FileExplorerContextMenu / TabContextMenu machinery for state, rendering, keyboard navigation (Up/Down/Enter/Esc), mouse hover-highlight, and click-to-activate. New EditorContextMenu type in app/types/context_menu.rs.
  • Each item dispatches the corresponding editor 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.
  • 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). The menu only opens over non-terminal buffer splits.
  • Typing any normal key dismisses the menu and falls through to normal input handling (the keystroke isn't swallowed); Esc / click-outside also dismiss.

Testing

  • New e2e test tests/e2e/editor_context_menu.rs (12 cases) drives real mouse/keyboard events through the same handle_mouse/handle_key path 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.
  • Manually validated in a tmux session against the real fresh binary: 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, and cargo fmt are clean for the changed files.
  • Adds editor.context.* locale keys across all 14 locales.

Generated by Claude Code

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.
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.

add right click mouse support

2 participants