Skip to content

feat(coding-agent): always-visible edit summary with inline Ctrl+J diff - #1392

Open
snimu wants to merge 11 commits into
feat/edit-diff-togglefrom
feat/edit-diff-inline-rendering
Open

feat(coding-agent): always-visible edit summary with inline Ctrl+J diff#1392
snimu wants to merge 11 commits into
feat/edit-diff-togglefrom
feat/edit-diff-inline-rendering

Conversation

@snimu

@snimu snimu commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What this does

Builds on #1388. The one-line edit summary (╰─ path +N −M) is now always visible, and Ctrl+J shows or hides the full diff directly beneath it.

Why

In #1388, pressing Ctrl+J swapped the summary line for the diff, which shifted the layout and made it harder to scan. Keeping the summary as a stable anchor — with the diff appearing indented under it — reads more like an expandable section: you always see which file changed and by how much, and the toggle just reveals the details.

How it works

  • Every edit shows its ╰─ path +N −M summary line in both states, with a dim (Ctrl+J to expand) / (Ctrl+J to collapse) hint on the most recent one.
  • Toggling Ctrl+J only adds or removes the diff lines underneath — nothing else moves.
  • The diff is indented to line up with the summary's text (after the ╰─ marker), the same way expanded agent messages indent their body under the summary line. Red/green highlighting is unchanged.
  • Long paths truncate to keep the summary on one line; long diff lines wrap and stay aligned at the same indent.
  • Edits that fail to apply show no summary or diff — just the error, with error coloring on the header — so predicted changes are never presented as applied.

Changes

  • The code-cell display now owns the whole summary-plus-diff block, and the classic built-in edit tool renders the identical line through a shared helper — so both look the same and the old separate summary component could be deleted.
  • Both paths format the file path the same way (resolved against the working directory, symlinks canonicalized), so the same file always shows the same path.
  • Tests cover: summary present in both states, diffs only when toggled, indentation, hint direction, one-row truncation for long paths, wrapped diff lines keeping their anchor, matching paths across both displays, and failed edits showing the error instead of the summary.

Lines changed (vs #1388): source +127/−95, tests +183/−34, changelog +1.

Checks

  • npm run check clean; all touched test suites pass (tool-execution-component 33, ipython-cell-diff 22, edit-summary 5, edit-tool-no-full-redraw 3, edit-tool-legacy-input 9).
  • Verified end-to-end in a real terminal: summary lines always visible; Ctrl+J reveals indented diffs beneath them and flips the hint; Ctrl+O expands code/output without touching diffs; both toggles work together.

Note

Show always-visible edit summary line with inline Ctrl+J diff toggle

  • Each edited file now always renders a ╰─ <path> +N -M summary line; pressing Ctrl+J toggles the diff body inline beneath it, indented to align with the summary text column.
  • Removes the separate FileChangeSummaryComponent from ToolExecutionComponent; summary/diff rendering is now owned by each tool renderer (edit.ts, ipython-cell.ts).
  • The Ctrl+J hint moves from the call header to the last file's summary line, and only appears when relevant.
  • The edit header background now correctly shows an error state when execution fails even if a successful preview exists.
  • Behavioral Change: callers using FileChangeSummaryComponent directly must migrate to formatFileChangeSummaryLine per file.

Macroscope summarized f1e4270.


Note

Low Risk
Interactive TUI rendering and test coverage only; no changes to edit execution, file I/O, or daemon protocol.

Overview
Edit rows in the coding-agent TUI now keep a stable ╰─ <path> +N -M line visible at all times; Ctrl+J only adds or removes indented diff lines underneath, instead of swapping the summary for the diff.

Built-in edit tool renders the summary via a shared formatFileChangeSummaryLine helper and a new EditChangeSummaryComponent (width-aware truncation, wrapped diff rows aligned with FILE_CHANGE_DIFF_INDENT). The expand hint moves off the header onto each summary row. Failed runs no longer show predicted diffs—the header uses error styling and the summary block is omitted.

IPython cells use the same summary formatting and indent rules; summary lines appear even when diffs are collapsed. The Ctrl+J hint shows on every tool row (not only the latest), once per cell on the last file’s summary line.

ToolExecutionComponent stops injecting a separate FileChangeSummaryComponent for collapsed edits—each renderer owns the full summary-plus-diff block.

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

Comment thread packages/coding-agent/src/core/tools/edit.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive/components/ipython-cell.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive/components/edit-summary.ts Outdated
snimu added 4 commits August 14, 2026 19:41
The edit-diff hint was threaded through showExpandHint, the flag that
restricts the ctrl+o hint to the latest tool row. Since the agent almost
always runs more tools after an edit, edit rows stopped being "latest"
immediately and the ctrl+j hint effectively never appeared.

The ctrl+j hint now renders on every edit summary row, matching the
always-visible thinking (ctrl+t) and agent-message (ctrl+p) hints. The
latest-row gating still applies to the ctrl+o hint on the header 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 f29dbb4. Configure here.

snimu added 6 commits August 16, 2026 12:14
…/edit-diff-inline-rendering

# Conflicts:
#	packages/coding-agent/src/core/tools/edit.ts
#	packages/coding-agent/test/tool-execution-component.test.ts
The hint renders on every tool row, but within a row only on the last
file's summary line — the comment claimed every summary row.
…/edit-diff-inline-rendering

# Conflicts:
#	packages/coding-agent/src/core/tools/edit.ts
#	packages/coding-agent/test/tool-execution-component.test.ts
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