Repository navigation
Align whole-document PDF changes and render shared regions once - #58
Merged
Merged
Conversation
A card's crops came from SyncTeX on each side separately and were compared alone, so the old and new crops often covered different text: unchanged words were marked, a heading edit could mark a whole section, and text that moved or a float that settled elsewhere read as rewritten. The two PDFs are now aligned once per round, word by word in reading order: runs of eight words that occur once in each pin them together, and the words between are compared. Marks are only words this comparison changed; removed and added runs that share runs of four words moved, shown in light blue on both sides. Each edit owns the lines its source printed (SyncTeX records, by majority; a record over many lines, such as a float's box, does not vote); text that only moved is an edit's only where its source printed it. A change of words is cut at the same equal words on both sides, so the context strips with the old crop read as the old document and with the new crop as the new one; words of the old crop the context shows fade. A change of layout alone is cut at the same equal lines, less those that print the same. A line across a crop's edge stays outside unless it reaches the crop's text, so a display above is not swallowed; empty strips are not written. Pages with two columns are cropped one column at a time, in reading order, with bands across the gutter (titles, wide tables) found from the glyphs, shapes and images that cross it. A page of one column with a few lines side by side stays one column. Also: word extraction joins hyphens in one pass instead of splicing, and a block of moved text is not labelled a reflow.
A card's crops came from SyncTeX on each side separately and were compared alone, so the old and new crops often covered different text: unchanged words were marked, a heading edit could mark a whole section, and text that moved or a float that settled elsewhere read as rewritten. The two PDFs are now aligned once per round, word by word in reading order: runs of eight words that occur once in each pin them together, and the words between are compared. Marks are only words this comparison changed; removed and added runs that share runs of four words moved, shown in light blue on both sides. Each edit owns the lines its source printed (SyncTeX records, by majority; a record over many lines, such as a float's box, does not vote); text that only moved is an edit's only where its source printed it. A change of words is cut at the same equal words on both sides, so the context strips with the old crop read as the old document and with the new crop as the new one; words of the old crop the context shows fade. A change of layout alone is cut at the same equal lines, less those that print the same. A line across a crop's edge stays outside unless it reaches the crop's text, so a display above is not swallowed; empty strips are not written. Pages with two columns are cropped one column at a time, in reading order, with bands across the gutter (titles, wide tables) found from the glyphs, shapes and images that cross it. A page of one column with a few lines side by side stays one column. Also: word extraction joins hyphens in one pass instead of splicing, and a block of moved text is not labelled a reflow.
The old crop shows whole rows, and words of a row before or after the change faded even when their counterparts printed in the new crop, which the context strips do not show: the old version of such a row could not be read, and a changed word of a neighbouring change could fade. A word now fades only when it equals a word outside the new crop.
cu1ch3n
marked this pull request as ready for review
November 6, 2026 12:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR compares complete PDFs before cutting review views, so text edits, moved passages and visual changes use one document correspondence. Source ownership determines the relevant edits, and overlapping review regions display shared ink once.
Final validation passed at
a2f3b02. The latest Windows and build-progress changes frommainare integrated. Adding the engine suite to Windows CI exposed inconsistent repository path identities; the client, server and Git now use the same native canonical paths. The original restart test remains enabled, with an additional directory-alias regression.Changes
Validation
For the final source:
main.main.The saved-PDF corpus includes 103 manuscript rounds, 39 synthetic rounds and 30 formula cases. Historical raw preservation flags and three formula coverage flags are retained as diagnostics, not relabelled as passing checks. A source-root adapter correction affects four historical build inputs and two rounds; only those two baseline rounds were rerendered with the corrected adapter. Two existing missing non-TeX metadata inputs are recorded without inventing replacements or dropping their units.
Comparison contract
Repeated text can admit multiple valid correspondences. A printed line-end hyphen can be indistinguishable from a discretionary typesetting hyphen. Unscoped drawing primitives share a page frame because PDF does not always retain the author's figure boundaries. Glyph sampling and 2x raster checks have finite resolution; this is not a proof of arbitrary PDF equivalence. Font ink can slightly overhang a highlight rectangle while remaining fully visible inside the crop.
The optional attribution contract is one verified sufficient combination, not all causal explanations. Renderer/compilation failures remain failures and never become successful truncated comparisons. The saved corpus covers direct crops; synthetic actual-publish tests separately cover indirect effects.
All manuscript inputs, screenshots and raw diagnostics remain private and local.