Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

diff: `-y` draws the gutter marker at the wrong column unless the gutter is 3 or 4 columns wide

未关闭
#269 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
rust
领域
cli

调研方向

首先跟踪 side-by-side 输出路径中的 Config::separator_pos 和 process_half_line,以查看 gutter 标记在哪里输出,以及第二列从哪里开始。使用 diff -y --width=40 和所述的宽度/制表符大小组合重现该问题,然后添加回归覆盖,展示对于更宽的 gutter,标记以 separator_pos 为中心。

由索引模型根据 Issue 内容生成。

描述

In side-by-side output, Config::separator_pos holds the middle of the gutter, but the gutter marker is not written there. It goes wherever process_half_line stopped padding the left half line, which is one column past sdiff_half_width. separator_pos is only read afterwards, to pad from the marker to the start of column two.

For a gutter g columns wide, separator_pos is sdiff_half_width + (g - 1) / 2. The two positions agree only when g is 3 or 4. The default --width=130 --tabsize=8 produces a gutter of exactly 3, which is why the default output looks correct, but any width or tab size where the tab alignment pushes column two further past the balance point drifts. --width=130 --tabsize=4 is off by one, --width=200 --tabsize=8 by two, --width=130 --tabsize=128 by 61.

printf 'aa\n' > f1; : > f2
diff -y --width=40 f1 f2 | expand | cat -A
aa                 <$
diffutils diff -y --width=40 f1 f2 | expand | cat -A
aa               <$
主要语言
Rust
星标
276
派生
39
平均合并
4 天 12 小时
30 天内合并 PR
3

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

uutils/diffutils 的其他 Issue

查看 uutils/diffutils 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。