当前一次对比可用, 初次创建可用
This commit is contained in:
60
.tasks/2025-10-22_1_improve-compare-output-format.md
Normal file
60
.tasks/2025-10-22_1_improve-compare-output-format.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# 背景
|
||||
文件名:2025-10-22_1_improve-compare-output-format.md
|
||||
创建于:2025-10-22_23:39:29
|
||||
创建者:用户
|
||||
主分支:main
|
||||
任务分支:main
|
||||
Yolo模式:Off
|
||||
|
||||
# 任务描述
|
||||
改进 `-c` 参数的文本对比输出格式,使其能够:
|
||||
1. 显示行号
|
||||
2. 显示每行的修改状态符号(+代表只有add,-代表只有delete,@代表既有add又有delete,=代表无修改)
|
||||
3. 在分组间添加分隔符(如横线)
|
||||
4. 保持现有的颜色功能
|
||||
|
||||
当前输出格式:
|
||||
```
|
||||
4123
|
||||
i get 13 history
|
||||
i get 24 history
|
||||
123
|
||||
operations:
|
||||
add "4" on [0,0]
|
||||
add "3
|
||||
i get 1" on [2,2]
|
||||
add " history
|
||||
i get 2" on [3,3]
|
||||
add " history
|
||||
123" on [4,4]
|
||||
```
|
||||
|
||||
期望输出格式:
|
||||
```
|
||||
+1|4123
|
||||
+2|i get 13 history
|
||||
+3|i get 24 history
|
||||
+4|123
|
||||
----
|
||||
```
|
||||
|
||||
# 项目概览
|
||||
这是一个基于Python的文本版本控制系统,使用 `-c` 参数进行文本对比。项目使用Convention模块进行配置管理和颜色输出。
|
||||
|
||||
# 分析
|
||||
当前 `compare` 方法在 `app.py` 第151-186行,使用 `levenshtein_distance_with_operations` 函数计算差异。需要:
|
||||
1. 修改输出逻辑,将操作转换为按行显示
|
||||
2. 为每行添加符号和行号
|
||||
3. 添加分组分隔符
|
||||
4. 保持颜色功能
|
||||
|
||||
# 提议的解决方案
|
||||
[待填写]
|
||||
|
||||
# 当前执行步骤:"1. 分析现有代码结构"
|
||||
|
||||
# 任务进度
|
||||
[待填写]
|
||||
|
||||
# 最终审查
|
||||
[待填写]
|
||||
Reference in New Issue
Block a user