pub fn transform_position(pos: Position, against: &Edit) -> PositionExpand description
Transform a position through the effect of an edit.
This is the OT inclusion transformation (IT): given a position pos
in the buffer state before against was applied, returns the
equivalent position in the buffer state after against.
§Tie-breaking (same-position edits)
Uses left-bias convention: when pos equals the edit position,
an Insert shifts pos right (the insert “happened before” our position),
while a Delete leaves pos unchanged (pos <= del_pos → no shift).
§Character counting
All column arithmetic uses Unicode scalar values (.chars().count()),
consistent with Position::column semantics.
§Example
use reovim_kernel::api::v1::*;
// Insert "abc" at (0,2) shifts position (0,5) to (0,8)
let pos = transform_position(
Position::new(0, 5),
&Edit::insert(Position::new(0, 2), "abc"),
);
assert_eq!(pos, Position::new(0, 8));