Skip to content

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

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

Add Ctrl+J to toggle edit diffs independently of tool output#1388
snimu wants to merge 2 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 keybinding to toggle edit diffs independently of tool output expansion

  • Adds a new app.edits.expand keybinding (Ctrl+J) that toggles edit diff visibility independently of the general tool output expand/collapse toggle.
  • Built-in edit tools and IPython-rendered cells now track a separate editDiffsExpanded state, so diffs can be shown while tool output remains collapsed (and vice versa).
  • When diffs are collapsed, a FileChangeSummaryComponent shows a +N -M line count summary with a (Ctrl+J to expand/collapse) hint.
  • The expansion state is propagated to all existing and newly created ToolExecutionComponent instances in InteractiveMode and reflected in the footer and help guide.
  • Behavioral Change: diff visibility for built-in edit tools is no longer governed by the general tool expansion toggle — only Ctrl+J controls it.

Macroscope summarized 551c530.

@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 2 potential issues.

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