Skip to main content

compute_baseline_diff_sign_map

Function compute_baseline_diff_sign_map 

Source
pub fn compute_baseline_diff_sign_map(hunks: &HunkIndex) -> DiffSignMap
Expand description

D-fix.3b: derive the BASELINE-side DiffSignMap from a HunkIndex.

The mirror of compute_diff_sign_map, walking each hunk’s baseline-side range (ranges[0]) instead of the current side — so the baseline (left) pane of a side-by-side diff tints the lines that were removed / changed relative to the proposed text:

  • Remove → every baseline line in the range gets Remove (these are the deleted lines; they DO exist on the baseline side, unlike the current side where compute_diff_sign_map skips them).
  • Change / Conflict → every baseline line gets Change / Conflict.
  • Add → no baseline-side line exists (the addition isn’t in the baseline), so it contributes nothing here.

Entries are sorted by line so DiffSignMap::sign_at binary-searches.