Emit how `ours` renders base lines `[from, to)` (plus the insertions parked at `to`), failing when the region mixes an ours change with a theirs change.
(
mapping: &OursRender,
_base_lines: &[Line],
ours_lines: &[Line],
output: &mut Vec<u8>,
from: usize,
to: usize,
parked_until: &mut usize,
)
| 676 | /// parked at `to`), failing when the region mixes an ours change with a |
| 677 | /// theirs change. |
| 678 | fn emit_ours_region( |
| 679 | mapping: &OursRender, |
| 680 | _base_lines: &[Line], |
| 681 | ours_lines: &[Line], |
| 682 | output: &mut Vec<u8>, |
| 683 | from: usize, |
| 684 | to: usize, |
| 685 | parked_until: &mut usize, |
| 686 | ) { |
| 687 | // Lines ours inserted at base positions the walk now passes come |
| 688 | // first, each exactly once. |
| 689 | while *parked_until <= from { |
| 690 | for ours_index in &mapping.inserted[*parked_until] { |
| 691 | output.extend_from_slice(ours_lines[*ours_index].content()); |
| 692 | } |
| 693 | *parked_until += 1; |
| 694 | } |
| 695 | for index in from..to { |
| 696 | if let Some(ours_index) = mapping.kept[index] { |
| 697 | output.extend_from_slice(ours_lines[ours_index].content()); |
| 698 | } else if let Some((start, len)) = mapping.changed[index] { |
| 699 | for i in 0..len { |
| 700 | output.extend_from_slice(ours_lines[start + i].content()); |
| 701 | } |
| 702 | } |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | let mut output: Vec<u8> = Vec::new(); |
| 707 | let mut base_cursor = 0usize; |