feat: show edit and write tools as line diffs
Expanding an edit, write or patch call now renders the change as tinted diff lines instead of an old/new text blob: added lines green, removed lines red, @@ hunk headers marked, and file header noise hidden. The patch comes from the server's metadata.files[].patch; older servers fall back to a line diff of the edit's old/new strings, and a write with only content shows as added lines. The tool row also shows +N −M for these calls, as dsh-Go does, and a phone-sized preview stops at 600 lines. 0.4.12 (412).
This commit is contained in:
1 parent
0f850b6191
commit
d533bc95ef
7 files changed
+541
-6
No files matched your search
@@ -5,6 +5,20 @@
|
||||
|
||||
---
|
||||
|
||||
## 0.4.12 编辑工具的 diff 显示(分支 `flutter`)
|
||||
|
||||
| 项 | 结果 |
|
||||
| --- | --- |
|
||||
| 展开为 diff | `edit` / `write` / `patch` 等文件修改工具展开后不再显示一整段 old/new 纯文本,而是逐行 diff:新增行绿色底、删除行红色底、`@@` hunk 头浅色标记、`---/+++` 等元信息变灰;长行软换行,整块可选中复制(对齐 dsh-Go / 上游 `ToolPartDiffPreview`) |
|
||||
| 数据来源 | 优先用服务端 `state.metadata.files[].patch`(可能多文件,按文件显示标题),其次 `metadata.patch` / `metadata.diff`;老服务端没有 patch 时用输入的 `oldString`/`newString` 做行级 LCS,`write` 只有 `content` 时显示为全新增行 |
|
||||
| 行尾统计 | 工具行右侧显示 `+N −M`(与 dsh-Go 一致),失败/运行中不显示 |
|
||||
| 大 diff | 最多渲染 600 行,超出显示「仅显示前 600 行,共 N 行」,避免聊天列表一次构建过多行 |
|
||||
| 结果行 | diff 下方保留一行工具自身结果(如「Edited PLAN.md (1 replacement)」),错误仍用错误色 |
|
||||
| 测试 | 新增 `test/diff_view_test.dart`:metadata patch 解析与增删计数、无 patch 的 old/new 回退、`write` 内容回退、失败/非文件工具不显示、DiffView 渲染增删行;57 项全过 |
|
||||
| 版本 | **0.4.12(code 412)** |
|
||||
|
||||
---
|
||||
|
||||
## 0.4.11 侧栏对齐调整(分支 `flutter`)
|
||||
|
||||
| 项 | 结果 |
|
||||
|
||||
Reference in new issue
Block a user