Skip to content

Add Ctrl+J to toggle edit diffs independently of tool output - #1388

Open
snimu wants to merge 5 commits into
mainfrom
feat/edit-diff-toggle
Open

Add Ctrl+J to toggle edit diffs independently of tool output#1388
snimu wants to merge 5 commits into
mainfrom
feat/edit-diff-toggle

Conversation

@snimu

@snimu snimu commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What this does

Adds Ctrl+J to show or hide edit diffs on their own, independent of Ctrl+O (tool output).

When the agent has made a few file edits in between many long tool calls, you can press Ctrl+J to see every edit's full diff — while all the noisy tool output stays collapsed. Ctrl+J is now the only switch for diffs: Ctrl+O still expands code and command output, but no longer shows or hides diffs. The two switches don't affect each other.

Why

Expanding tool output was the only way to see a diff in full. With long-running work that means wading through hundreds of lines of command output just to check a handful of edits.

How it works

  • Every edit shows its one-line summary (path +N −M) with a dim (Ctrl+J to expand) hint next to it. With Ctrl+J on, the full diff renders in place of that summary — code and command output stay behind Ctrl+O.
  • The switch follows the same pattern as the existing independent toggles (Ctrl+O tools, Ctrl+P agent messages, Ctrl+T thinking) and is remappable like every other keybinding.
  • Default is off, and the choice isn't persisted between sessions, matching the other two expansion toggles.

Changes

  • Diff rendering now keys off the new toggle alone, in both display paths: code cells (the usual case) and the classic built-in edit tool. The old "expand everything" overlap was removed, which simplified the display logic.
  • Standard toggle plumbing: keybinding, hint texts, shortcuts panel, docs row.
  • The edit summary line carries the Ctrl+J hint, following the existing hint style and only on the most recent tool, like other hints.
  • Tests for the toggle in both paths, the hint, and the keybinding.

Lines changed (vs main): source +77/−11, tests +111/−9, docs and changelog +2/−0.

Checks

  • npm run check clean; all touched test files pass (~260 tests across the areas).
  • Validated end-to-end in a real terminal: 200-line noisy tool calls plus two edits — Ctrl+J shows just the diffs, off hides them, Ctrl+O expands code/output without touching diffs. Also verified Ctrl+J is received distinctly from Enter in tmux; terminals that can't send it can remap the binding.

Note

Add Ctrl+J to toggle edit diffs independently of tool output expansion

  • Introduces a new app.edits.expand keybinding (ctrl+j) that toggles edit diff visibility separately from the general tool output expansion (ctrl+o).
  • Adds an editDiffsExpanded state to ToolExecutionComponent, IPythonCellComponent, and InteractiveMode, decoupling diff display from the general expanded state.
  • When edit diffs are collapsed, built-in edit and IPython tools show a FileChangeSummaryComponent with a ctrl+j hint; when expanded, full diffs render instead.
  • The expand hint moves from the tool header to the summary line once a result is settled, avoiding duplication.
  • Behavioral Change: IPython cell diffs and built-in edit diffs are now controlled by editDiffsExpanded rather than expanded, so collapsing tool output no longer hides diffs.

Macroscope summarized 77ea530.


Note

Low Risk
Interactive UI and keybinding behavior only; no auth, persistence, or file-mutation logic changes beyond how diffs are displayed.

Overview
Adds app.edits.expand (Ctrl+J) as a dedicated toggle for edit diff visibility, matching the pattern used for tool output (Ctrl+O), agent messages, and thinking blocks.

Ctrl+O no longer shows or hides diffs — built-in edit tools and IPython edit cells now drive diff rendering from editDiffsExpanded state in InteractiveMode, propagated via setEditDiffsExpanded on tool and conversation components. Collapsed edits still show the ╰─ path +N -M summary; full diffs appear only when this toggle is on, while Ctrl+O continues to control general tool/code expansion.

UI polish: the expand hint moves to app.edits.expand on the file-change summary line (header only before a settled result or on errors), with keybinding registration, shortcuts/help text, docs, and tests updated for both render paths.

Reviewed by Cursor Bugbot for commit 77ea530. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread packages/coding-agent/src/modes/interactive/components/tool-execution.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive/components/tool-execution.ts Outdated
Comment thread packages/coding-agent/src/core/tools/edit.ts Outdated
Collapsed built-in edits showed the hint twice: on the edit header and on
the summary line. The header hint now renders only when the diff is
expanded (where no summary line exists); collapsed rows keep the single
hint on the summary line.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 13ab4c2. Configure here.

Comment thread packages/coding-agent/src/core/tools/edit.ts
… renders

Gating the header hint on expansion assumed the collapsed summary line
always carries the cue, but that summary only mounts once a successful
result with a countable diff lands. During the preview-only window and on
error rows the diff was expandable with no visible hint.

The header now keeps the hint whenever the summary line is absent
(mirroring its mount condition) and yields it once the summary renders,
so exactly one hint is visible in every state.
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