sdiff: fix the layout of unchanged rows, blank lines and cut tabs
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 28/100
Research direction
Work is already claimed by open PR 301. The issue names src/side_diff.rs and confines the change to process_half_line and push_output: print each half’s text, keep the column where output stopped, and pad from that column to the marker and to column two. Compare against GNU diff -y with --width and --expand-tabs using the given L/R examples; done when unchanged rows, blank lines, and cut tabs match GNU layout.
Written by the indexing model from the issue text.
Description
src/side_diff.rs pads the left half up to a fixed column and writes the right half after it, instead of padding from the column where the text ended. Three rows come out different from GNU diff:
- The right half of an unchanged row starts at
half_width + 3instead of column two. The two are the same at the default--width=130, so it only shows at other widths and with--expand-tabs. - A blank line common to both files is padded up to column two instead of left empty.
- A tab that reaches the end of the half is dropped, and the text after it is still printed. GNU diff cuts the row at that tab.
Tabs are shown as ^I and line ends as $:
$ diff -y --width=40 L R | cat -A # L: a,(blank),b,c R: a,(blank),c
a^I^I a$
^I^I $
b^I^I <$
c^I^I c$
$ diff -y --width=10 L R | cat -A # L: a<TAB>b,c R: c
ab <$
c c$
GNU diff 3.10 prints:
a^I^I^Ia$
$
b^I^I <$
c^I^I^Ic$
a <$
c^Ic$
So the change is confined to process_half_line and push_output. Print only the text of each half, keep the column where the output stopped, and pad from that column to the marker and to column two.
- Dominant language
- Rust
- Stars
- 276
- Forks
- 44
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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
-
cmp: quiet mode compares full file sizes before applying -nPossibly taken @SichenLiang claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
diff: `-y --tabsize=<huge>` overflows the column arithmetic (overflow-checks only)Possibly taken @sami-daniel claimed this 59 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
diff panics on an oversized inline context count (`-c`/`-u`/`-C`/`-U`): parse overflow and capacity overflowPossibly taken @MsfPablo claimed this 55 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
uutils/diffutils#245 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
All issues in uutils/diffutils
Similar issues
-
llm translation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
area: backend type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
armadavalor/WinKnife#6 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
5omeOtherGuy/phaseone#870 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 72/100
MattA-Official/vwmcp#20 ·