调用 Edit 工具修改文件后,文件中每行之间出现多余空行。Git diff 显示整个文件所有行都被标记为变更。

用 cat -A 检查原始字节,发现换行符从正常的 ^M$(\r\n)变成了 ^M^M$(\r\r\n)——多了一个回车符。
修改前:
TUserRequestLog finalRequestLog = new TUserRequestLog();^M$try {^M$
修改后:
TUserRequestLog finalRequestLog = new TUserRequestLog();^M^M$finalRequestLog.setId(id);^M^M$
try {^M^M$
在 Windows 环境下,对任意 CRLF 文本文件调用 Edit 工具
用 cat -A 查看文件原始内容,换行符变为 \r\r\n
每次 Edit 后都需要手动修复
Git 历史污染(diff 显示全文件变更)
代码可读性差(IDE 中显示多余空行)
tr -d '\r' < file | unix2dos > file.tmp && mv file.tmp fileEdit 工具应保持原文件的换行符格式不变,不额外插入 \r。
Please authenticate to join the conversation.
In Review
Bug Reports
10 days ago

唇洁
Get notified by email when there are changes.
In Review
Bug Reports
10 days ago

唇洁
Get notified by email when there are changes.