Skip to content

Show unchanged lines that fall inside an inline hunk - #1018

Open
DivvyCr wants to merge 2 commits into
Wilfred:masterfrom
DivvyCr:include-all-unchanged-lines-within-hunk
Open

Show unchanged lines that fall inside an inline hunk#1018
DivvyCr wants to merge 2 commits into
Wilfred:masterfrom
DivvyCr:include-all-unchanged-lines-within-hunk

Conversation

@DivvyCr

@DivvyCr DivvyCr commented Jul 22, 2026

Copy link
Copy Markdown

Follow-up to PR #980 to close Issues #349 , #704 , #978

DivvyCr added 2 commits July 22, 2026 20:16
When two novel lines in a hunk are close enough to merge into a single
hunk, the unchanged lines between them ar dropped from inline display
output. Side-by-side rendering uses matched_lines_indexes_for_hunk to
walk the full hunk range, so it already includes these lines. Inline
was iterating hunk.lines directly, which only contains positions with
novel content.

For an example, see issue Wilfred#978 or the new CLI integration test.

Add a `fill_in_hunk_gaps` helper that walks `hunk.lines` and emits the
intervening line numbers for each side, then update the LHS and RHS
print loops to use the hunk's `novel_lhs` and `novel_rhs` sets so that
gap lines render as context rather than as added or removed.
@DivvyCr

DivvyCr commented Jul 22, 2026

Copy link
Copy Markdown
Author

Here are some sample outputs on inputs from the issues:

difftastic-1018

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.

1 participant