Skip to main content

resolved_to_original

Function resolved_to_original 

Source
pub(crate) fn resolved_to_original(
    offset: usize,
    substitutions: &[Substitution],
) -> usize
Expand description

Map a byte offset in resolved text back to the corresponding offset in original text.

Walks substitutions in order, tracking the cumulative delta between original and resolved positions. If offset falls before the next substitution in resolved space, applies the running delta. If inside a substitution’s resolved span, clamps to that substitution’s original start. Otherwise continues accumulating delta.