FA-75644 / Text diff and three-way merge / Member archive
Line mapping through hunks: the line after a changed range is reported as removed · case 04
A comment on the first unchanged line after a hunk is dropped.
Case contract
Hunks [old_start, old_len, new_start, new_len] use unified conventions (start is the line before when the length is 0) and are sorted. An old line maps to None if it lies in a hunk's old range; otherwise it moves by the sum of new_len - old_len over hunks entirely before it. A zero-length hunk after line s affects lines from s+1 on. Return the mapped line numbers.
Why this case matters
Review tools re-anchor comments on changed files by mapping old line numbers through the diff.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| lines before and after a replacement | [4, null, null, null, 9] | [4, null, null, 8, 9] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗