Skip to content

diff: place -y gutter marker at the middle of the gutter - #277

Open
nagendramohan wants to merge 1 commit into
uutils:mainfrom
nagendramohan:fix/sdiff-gutter-marker-column-269
Open

diff: place -y gutter marker at the middle of the gutter#277
nagendramohan wants to merge 1 commit into
uutils:mainfrom
nagendramohan:fix/sdiff-gutter-marker-column-269

Conversation

@nagendramohan

Copy link
Copy Markdown

In side-by-side (-y) output the gutter marker was written wherever process_half_line stopped
padding the left half (one column past sdiff_half_width), not at separator_pos (the middle of
the gutter). Those agree only when the gutter is 3–4 columns wide, so the default
--width=130 --tabsize=8 (gutter 3) looked right while other widths/tab sizes drifted — e.g.
--width=40 placed < at column 17 instead of 19.

Pad from half_width + 1 up to separator_pos before writing the marker so it lands at the gutter
middle, matching GNU sdiff. format_tabs_and_spaces is a no-op when already at/past separator_pos,
so narrow gutters are unaffected. Added a regression test at --width=40.

Fixes #269.

In side-by-side output the gutter marker was written wherever
process_half_line stopped padding the left half (one column past
sdiff_half_width), not at separator_pos (the middle of the gutter).
Those agree only when the gutter is 3 or 4 columns wide, so the default
--width=130 --tabsize=8 (gutter 3) looked right while other widths/tab
sizes drifted (e.g. --width=40 placed '<' at column 17 instead of 19).

Pad from half_width + 1 up to separator_pos before writing the marker so
it lands at the gutter middle, matching GNU sdiff. format_tabs_and_spaces
is a no-op when already at/past separator_pos, so narrow gutters are
unaffected. Add a regression test at --width=40.

Fixes uutils#269
@github-actions

Copy link
Copy Markdown

GNU diffutils testsuite comparison:

Test results comparison:
  Current:   TOTAL: 33 / PASSED: 0 / FAILED: 33 / SKIPPED: 0
  Reference: TOTAL: 33 / PASSED: 8 / FAILED: 21 / SKIPPED: 4

Changes from main branch:
  TOTAL: +0
  PASSED: -8
  FAILED: +12

New test failures (12):
  - basic
  - bignum
  - brief-vs-stat-zero-kernel-lies
  - bug-64316
  - cmp
  - diff3
  - help-version
  - large-subopt
  - strcoll-0-names
  - strip-trailing-cr
  - timezone
  - y2038-vs-32bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant