Reuse XeTeX suffixes across physical line edits

This commit is contained in:
gloamxun committed 2026-12-02 00:22:21 +08:00
1 parent 0b4aa49a71
commit bf42a88dff
5 files changed
+337 -73

No files matched your search

@@ -184,7 +184,8 @@ impl EntryCheckpoint {
.then_some((previous_bytes.len(), current_bytes.len()));
let relocation = match entry_sizes {
Some(_) => {
let map = SourceRelocation::new(self.entry, previous_bytes, current_bytes)?;
let map = self.source_mouth(self.entry)
.relocation_from(prior.source_mouth(prior.entry))?;
if map.relocate_offset(prior.frontier) != Some(self.frontier) {
return None;
}
@@ -199,11 +200,13 @@ impl EntryCheckpoint {
if observes_entry_line
&& relocation.as_ref().map_or_else(
|| !SourceRelocation::same_line_breaks(previous_bytes, current_bytes),
SourceRelocation::changes_line_numbers,
|map| map.changes_line_numbers() || map.physical_framing().0.unit_width() != 1,
)
{
// The old line number can be embedded in outputs. Equal byte
// offsets can also mean different lines if a newline moved.
// In wide encodings even a same-line edit can change the number
// of raw CR/LF bytes counted by byte-based diagnostic fallbacks.
return None;
}
let line_observations = match &completed.line_observations {