diff: `-y` draws the gutter marker at the wrong column unless the gutter is 3 or 4 columns wide
還沒有人認領這個 Issue。
評估
研究方向
首先追蹤 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
- 星號
- 277
- 分支
- 40
- 平均合併
- 4 天 12 小時
- 30 天內合併 PR
- 3
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
uutils/diffutils 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 85/100
-
難度 2/5 1-3 小時 新手友好度 72/100
-
難度 2/5 1-3 小時 新手友好度 68/100
-
難度 4/5 3-5 天 新手友好度 45/100
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 84/100
linebender/parley#849 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 86/100
boxlite-ai/boxlite#1729 ·
維護者通常 1 天內回覆
-
external
難度 2/5 1-3 小時 新手友好度 68/100
langchain-ai/docs#6255 ·
維護者通常 1 天內回覆
-
P2 testing
難度 1/5 1 小時以內 新手友好度 90/100
維護者通常 1 天內回覆