Skip to content

Comments

TUI: syntax-highlighted diff view for write/edit tool output#455

Merged
bug-ops merged 3 commits intomainfrom
feat/m27/tui-diff-view
Feb 17, 2026
Merged

TUI: syntax-highlighted diff view for write/edit tool output#455
bug-ops merged 3 commits intomainfrom
feat/m27/tui-diff-view

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 17, 2026

Summary

  • Render write/edit tool results as syntax-highlighted diffs in TUI chat panel
  • FileExecutor captures old content before modifications, populates DiffData on ToolOutput
  • Data flows through agent events to TUI where widgets/diff.rs renders with diff-colored backgrounds
  • Green/red backgrounds for added/removed lines, brighter highlights for word-level changes
  • Syntax highlighting via existing tree-sitter infrastructure
  • Compact/expanded toggle reuses existing e key binding

Changes

  • New: crates/zeph-core/src/diff.rsDiffData struct for cross-crate sharing
  • New: crates/zeph-tui/src/widgets/diff.rs — diff computation (similar crate) + rendering
  • Modified: crates/zeph-tools/src/file.rs — capture old content before write/edit
  • Modified: crates/zeph-tui/src/widgets/chat.rs — integrate diff rendering in tool messages
  • Modified: 20 other files for DiffData propagation through the pipeline

Dependencies

  • similar 2.7.0 — pure Rust line/word diff (MIT, no unsafe, no transitive deps)

Follow-up issues

  • Cache computed diff lines to avoid per-frame recomputation (perf)
  • Add ~1MB size cap on DiffData content (security hardening)
  • Add DiffData assertions to FileExecutor tests (test coverage)

Test plan

  • cargo build --features tui
  • cargo clippy --workspace -- -D warnings
  • cargo +nightly fmt --check
  • cargo nextest run --workspace --lib --bins (1563 tests pass)
  • Manual: run cargo run -- --tui, trigger write/edit tool, verify diff rendering

Closes #451

@bug-ops bug-ops force-pushed the feat/m27/tui-diff-view branch from 36c7831 to 3d922cd Compare February 17, 2026 16:15
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 17, 2026
@bug-ops bug-ops enabled auto-merge (squash) February 17, 2026 16:16
@github-actions github-actions bot added the tests label Feb 17, 2026
Add diff rendering to TUI chat panel for write and edit tool results.
FileExecutor captures old content before modifications, propagates
DiffData through agent events to TUI where it renders with green/red
backgrounds for added/removed lines, word-level change highlighting,
and syntax coloring via tree-sitter. Compact/expanded toggle reuses
existing 'e' key binding.

Closes #451
@bug-ops bug-ops force-pushed the feat/m27/tui-diff-view branch from 2a9f4ba to 21405cb Compare February 17, 2026 16:41
@bug-ops bug-ops merged commit 3ce3f34 into main Feb 17, 2026
20 checks passed
@bug-ops bug-ops deleted the feat/m27/tui-diff-view branch February 17, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core dependencies documentation Improvements or additions to documentation rust size/L tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: syntax-highlighted diff view for write/edit tool output

1 participant