diff: place -y gutter marker at the middle of the gutter - #277
Open
nagendramohan wants to merge 1 commit into
Open
diff: place -y gutter marker at the middle of the gutter#277nagendramohan wants to merge 1 commit into
nagendramohan wants to merge 1 commit into
Conversation
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
|
GNU diffutils testsuite comparison: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In side-by-side (
-y) output the gutter marker was written whereverprocess_half_linestoppedpadding the left half (one column past
sdiff_half_width), not atseparator_pos(the middle ofthe 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=40placed<at column 17 instead of 19.Pad from
half_width + 1up toseparator_posbefore writing the marker so it lands at the guttermiddle, matching GNU sdiff.
format_tabs_and_spacesis a no-op when already at/pastseparator_pos,so narrow gutters are unaffected. Added a regression test at
--width=40.Fixes #269.