Skip to content

feat(ui): right-click context menus across the app - #575

Merged
Tryanks merged 1 commit into
mainfrom
feat/context-menus
Oct 1, 2026
Merged

Tryanks merged 1 commit into
mainfrom
feat/context-menus

Conversation

@Tryanks

@Tryanks Tryanks commented Oct 1, 2026

Copy link
Copy Markdown
Owner

What changes

Right-click menus for every surface that lacked one. Before this, only Markdown links, sidebar project headers, thread rows and the terminal pane had a menu; text inputs had none on desktop (gpui-base only shows one when a handler is registered, and none was).

  • Text inputs (widgets/input.rs): Cut / Copy / Paste / Select All on right-click for every Input and Textarea, from the editor's own InputContextMenuCapabilities, items disabled rather than hidden. Choices are forwarded to the field's focus handle, as the touch edit menu already does.
  • Markdown view: the menu opens anywhere, not only on a link. It offers Copy (enabled while there is a window selection, through the root's Copy) and Select All, then the link, code block ("Copy code") or image under the pointer (open image, copy image address, or path items for a local file), then the hosting surface's items via a new MarkdownView::menu_extension hook. pending_context_link became a PendingContextTarget enum.
  • Shared menu actions (widgets/menu.rs): CopyText, OpenUrl, OpenPath, OpenPathInZed, RevealPath are handled by every ContextMenu trigger, so a surface can offer them without wiring handlers. PopupMenu::path_items and selection_items are the reusable groups. The two identical open_in_zed helpers in chat and markdown collapse into one here.
  • Chat: assistant and user messages (copy message, rewind modes as the rewind popover offers them), user attachments (path items), tool-call / command / reasoning rows (copy command, input, output, text), error cards (copy error), changed-file chips and live edit rows (view diff, path items), proposed plan cards (copy / download / save), header title (copy title, workspace path items).
  • Plan panel: copy / download / save; it owns the PlanMenu action the chat's plan card also dispatches.
  • Diff view: file header gets path items; code rows get copy line, copy selected lines, add comment.
  • Terminal tabs: restart, split horizontally / vertically, close tab.
  • Composer: terminal and review chips (copy text, remove), queued messages (copy, send now / steer, edit in composer, remove), pending images (open, path items, remove).
  • Provider card: copy update command.

Not touched: the preview panel (a wry webview with the system's own native menu) and the terminal pane menu, which was already complete.

Tests

  • markdown::view::tests::right_click_off_link_is_swallowed_so_no_menu_opens stated the old contract (no menu on plain text). It is rewritten as right_click_on_text_opens_the_selection_menu_and_is_swallowed: a plain-text right-click still does not propagate, now opens the view's menu, Select All from it selects the view, and Copy then writes the selection to the clipboard. Both right-click tests now mount under gpui_base::Root, as the shell does, since Root owns Copy for the window selection.
  • link_context_menu_action_opens_the_url adjusts its keystrokes for the two items now preceding "Open link".
  • changed_files probe and gallery_support take the new cwd / rewind_menu parameters.

Checks run

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo nextest run -p tcode-ui — 349 passed
  • Launched the desktop app on a throwaway profile and drove a text field: right-click shows Cut / Copy disabled with no selection and Paste / Select All enabled; after Select All all four are enabled and Cut empties the field. Chat, diff and terminal menus were not exercised live (they need a provider session); the Markdown menu is covered by the headless tests.
  • Not run locally: mobile / Web / machete CI jobs.

…inal and composer

Every text field gets Cut / Copy / Paste / Select All on right-click,
built in the Input wrapper from the editor's own capabilities. The
Markdown view's menu no longer needs a link under the pointer: it offers
Copy (with a window selection) and Select All, then the link, code block
("Copy code") or image under the pointer, then the hosting surface's own
items through a new `menu_extension` hook.

Shared menu actions (CopyText, OpenUrl, OpenPath, OpenPathInZed,
RevealPath) are handled by every context-menu trigger, with
`path_items` and `selection_items` as reusable groups; the two local
`open_in_zed` helpers collapse into one.

Surfaces gaining a menu: assistant and user messages (copy message,
rewind modes), user attachments, tool-call and command rows (copy
command / input / output / text), error cards, changed-file chips and
live edit rows (view diff, path items), proposed plan cards and the plan
panel (copy / download / save), the chat header title, diff file headers
(path items) and code rows (copy line, copy selected lines, add
comment), terminal tabs (restart, split, close), composer context chips,
queued messages (copy, send now, edit, remove), pending images, and the
provider update command.

Co-Authored-By: Claude <noreply@anthropic.com>
@Tryanks
Tryanks merged commit 464775e into main Oct 1, 2026
7 checks passed
@Tryanks
Tryanks deleted the feat/context-menus branch October 1, 2026 19:46
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.

1 participant