Build a map from base index → action for modifications only (not keeps).
(ops: &[EditOp])
| 371 | |
| 372 | /// Build a map from base index → action for modifications only (not keeps). |
| 373 | fn build_action_map(ops: &[EditOp]) -> HashMap<usize, Action> { |
| 374 | let mut map = HashMap::new(); |
| 375 | for op in ops { |
| 376 | match op { |
| 377 | EditOp::Replace(idx, content) => { |
| 378 | map.insert(*idx, Action::Replace(content.clone())); |
| 379 | } |
| 380 | EditOp::Delete(idx) => { |
| 381 | map.insert(*idx, Action::Delete); |
| 382 | } |
| 383 | _ => {} |
| 384 | } |
| 385 | } |
| 386 | map |
| 387 | } |
| 388 | |
| 389 | /// Emit the result of an action (replace or delete) on a base token. |
| 390 | fn emit_action(action: &Action, _base_token: &MergeToken, result: &mut Vec<u8>) { |