opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Feature Request: TUI option for minimal/collapsed diff display

Open sukakcoding opened this issue 10 months ago • 6 comments

Problem

When editing large files (300-500+ lines), the diff output in the TUI becomes very long and requires extensive scrolling. This makes it hard to follow the conversation flow.

Current Behavior

✅ Edited file src/components/App.tsx
┌─────────────────────────────────────────────────┐
│ - old line 1                                    │
│ + new line 1                                    │
│ - old line 2                                    │
│ + new line 2                                    │
│ ... (500 more lines of diff) ...                │
└─────────────────────────────────────────────────┘

Expected Behavior

Minimal mode - clean, compact:

✅ Edited file src/components/App.tsx (+245, -123 lines)

Minimal + expandable - click to see full diff:

✅ Edited file src/components/App.tsx (+245, -123 lines) [expand]

Use Case

  • Large refactors with many line changes
  • Generated code (500+ lines)
  • Config file updates
  • Keeping conversation flow readable

Suggested Implementation

New TUI config option in opencode.json:

{
  "tui": {
    "diff_display": "minimal"
  }
}
Mode Behavior
full Show complete diff (current default)
minimal Show only filename + line counts, with option to expand

When minimal:

  • Default view: collapsed (filename + stats only)
  • User can expand to see full diff if needed

Important Note

UI vs Context Separation:

The minimal feature should ideally:

  • UI: Show minimal/collapsed for clean scrolling experience
  • AI Context: Keep full diff in conversation history so AI maintains understanding

This prevents AI from "forgetting" what was edited while keeping the TUI clean for users.

User sees:  ✅ Edited file App.tsx (+50, -30 lines) [expand]
AI sees:    Full diff content in context for continuity

sukakcoding avatar Jan 17 '26 15:01 sukakcoding

This issue might be a duplicate or related to existing issues. Please check:

  • #8450: Diff/Write/Edit view visibility is truncated now and require too much scrolling - directly addresses the same pain point of excessive scrolling when viewing diffs
  • #9026: TUI: Add full-file diff toggle in permission fullscreen view - similar request for diff display control (though specific to permissions)
  • #9017, #9018, #9019: Compact Mode Phase 1-3 - broader feature addressing readability of large content through multi-level display hierarchy (FULL, COLLAPSED, SHORTHAND, HIDDEN) which may provide a more comprehensive solution

Feel free to ignore if your use case is specifically different from these.

github-actions[bot] avatar Jan 17 '26 15:01 github-actions[bot]

Hi! I'd like to work on this feature. Before I start implementation, I have a couple of questions:

  1. Compact Mode overlap: I noticed there's a planned Compact Mode feature (#9017-9019) that includes a 4-level display hierarchy (FULL, COLLAPSED, SHORTHAND, HIDDEN). Would this diff display feature conflict with or be superseded by Compact Mode? Or should they be implemented independently?

  2. Design review requirement: Per CONTRIBUTING guidelines, core UI features may require design review. Does this feature need design approval before implementation?

My proposed approach

If this is good to implement, my plan would be:

  • Add a new tui.diff_display config option ("full" | "minimal")
  • When "minimal": Edit/Write tools show collapsed by default (filename + line stats)
  • User can click to expand and see full diff
  • Full diff remains in message metadata for AI context (no changes to AI understanding)

Please let me know if this aligns with the team's vision, or if I should wait for Compact Mode instead.

LIHUA919 avatar Jan 17 '26 15:01 LIHUA919

I think there might be two separate issues worth distinguishing here:

  1. The one described in this issue – large files produce large diffs (500+ lines of changes).
  2. A different case I'm experiencing – even a small change (a few lines) produces a surprisingly long diff in the TUI.

In the second case, I suspect the culprit is the context lines surrounding each change. Standard unified diff includes several unchanged lines around every hunk, and if opencode renders those without collapsing, or uses a large context window – even a 2-line edit can look massive in the TUI.

It would be worth knowing whether these two cases share the same root cause or need separate solutions. Either way, the minimal/collapsed diff view proposed here would help with both.


Note: "Hide tool details" (accessible via Ctrl+P command palette) hides all tool execution info including every tool call opencode makes. This is worth mentioning because being able to see tool calls is actually a safety feature – for example, if opencode runs a shell command that looks suspicious or potentially malicious, you can catch it and interrupt before it does any damage. Hiding tool details removes that visibility entirely, so it's not a practical workaround for the diff verbosity problem.

kolinekp avatar Mar 11 '26 21:03 kolinekp

I would double-down on this feature request. The issue is exacerbated when developing a new project from scratch or writing detailed .md docs. In such cases many hundreds of lines are displayed in terminal and one needs to scroll past them to get to previous messages. This is time consuming and frustrating when trying to navigate back and forth within a discussion

A better option would be to collapse the content of the tool calls and keep the header e.g. "Wrote hello-world/src/App.css" which can be toggled to see the full contents if needed. As mentioned above "Hide tool details" hides all tool execution info including headers making what happened during the execution very opaque.

A new setting providing a balance between those two extremes (show everything vs hide everything) by keeping headers and hiding full content behind toggle would be a very desirable improvement

Image

maxsoldev avatar Apr 08 '26 16:04 maxsoldev

To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

github-actions[bot] avatar Jul 06 '26 03:07 github-actions[bot]

The more agent driven we act (OpenSpec, BMad etc.), the less we care about diffs and the more we care about the general chat log. I think it's a big miss.

JonasDoe avatar Jul 06 '26 12:07 JonasDoe