diff: `-y` draws the gutter marker at the wrong column unless the gutter is 3 or 4 columns wide
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start by tracing Config::separator_pos and process_half_line in the side-by-side output path to see where the gutter marker is emitted versus where column two begins. Reproduce the issue with diff -y --width=40 and the width/tab-size combinations described, then add regression coverage showing the marker is centered at separator_pos for wider gutters.
Written by the indexing model from the issue text.
Description
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 <$
- Dominant language
- Rust
- Stars
- 276
- Forks
- 39
- Avg merge
- 3h 27m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uutils/diffutils
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 64/100
All issues in uutils/diffutils
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100