Repository navigation
feat(chat): show the lines each edit adds and removes, with its diff - #264
Merged
Merged
Conversation
The daemon counts the lines a Write, Edit or MultiEdit call adds and removes from its whole input, before the chat cuts it at 4 KB, and keeps them in the tool item (`lines`). The tool line shows "+N -M", and opening it shows the diff of each replacement instead of the raw input. The app compares lines the same way the daemon counts them, so both agree. No counts for an Edit with replace_all (the input does not say how many matches) or when the input has no texts (Codex and Antigravity send only the path). Spec 8.2 and 15.3 updated.
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.
What
Each file edit in the chat now says how much it changed, and opens to its diff.
botloft_core::edits): counts the lines aWrite,EditorMultiEditcall adds and removes, from its whole input, before the chat cuts it at 4 KB. They go in the tool item aslines: { added, removed }; older items and other tools havenull.+N −M(a zero side is left out; nothing on a failed call). Opened, it shows "Changes": one block per replacement, with shared lines, removed lines marked−and added lines marked+. The app compares lines the way the daemon counts them, so the diff and the numbers agree. When the input was cut, the line opens to the input as before, with a note that the change is too long to show.Editwithreplace_all(the input does not say how many matches) or when the input has no texts: Codex and Antigravity send only the path.pnpm devpreview has a real edit in the Writer's chat.Tests
edits.rs: edits, moved lines,MultiEdit,Write, no texts,replace_all, a huge edit past the comparison limit.tests/chat.rs: an edit bigger than 4 KB keeps its counts after the input is cut, and through the update when it finishes.editDiff.test.tsx: line splitting and counts match the daemon's cases; counts and diff on the line; the cut-input note; no counts on a failed call.cargo fmt,clippy -D warnings,cargo test --workspaceandpnpm checkpass locally.Manual test with the real Claude Code
Not done yet. With the dev daemon, ask an agent to edit a file (one
Edit, then a new file withWrite) and check that the line shows+N −Mmatching the change and that opening it shows the diff.