feat: add diff preview for MultiEdit, Write, and ApplyPatch in TUI#69
Merged
yishuiliunian merged 1 commit intomainfrom Apr 3, 2026
Merged
feat: add diff preview for MultiEdit, Write, and ApplyPatch in TUI#69yishuiliunian merged 1 commit intomainfrom
yishuiliunian merged 1 commit intomainfrom
Conversation
Previously only the Edit tool rendered colored diff previews in the
tool display. MultiEdit read top-level old_string/new_string (missing
for its edits-array schema), Write showed only bytes written, and
ApplyPatch fell through to the default renderer.
- Extract diff visualization primitives into diff_style.rs (DiffResult,
semantic colors, removed_line/added_line, fold_indicator)
- Extract generic output formatting into output_format.rs to free
mod.rs headroom for future tool dispatch
- MultiEdit: iterate edits array with shared budget, aggregate diff
- Write: content preview via render_diff_lines("", content, max)
- ApplyPatch: parse patch text for ***/+/- lines, colored rendering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
+lines), and ApplyPatch (parse patch text for***/+/-lines)diff_style.rs(shared diff visualization primitives:DiffResult, semantic colors,removed_line/added_line,fold_indicator)output_format.rsfrommod.rsto separate dispatch from output formatting, freeing 34 lines of headroomChanges
crates/loopal-tui/src/views/progress/tool_display/diff_style.rs— new (91 lines)crates/loopal-tui/src/views/progress/tool_display/output_format.rs— new (38 lines)crates/loopal-tui/src/views/progress/tool_display/apply_patch.rs— new (80 lines)crates/loopal-tui/src/views/progress/tool_display/edit.rs— refactored to usediff_style, addedrender_multi_edit_bodycrates/loopal-tui/src/views/progress/tool_display/write.rs— enhanced with content preview viarender_diff_linescrates/loopal-tui/src/views/progress/tool_display/mod.rs— register new modules, split Edit/MultiEdit dispatchTest plan
bazel build //crates/loopal-tui:loopal-tuipassesbazel build //crates/loopal-tui:loopal-tui --config=clippyzero warningsbazel build //crates/loopal-tui:loopal-tui --config=rustfmtpassesbazel test //crates/loopal-tui:loopal-tui_testpasses