A shortest diff is not always unique. When identical lines repeat, the algorithm can often match an early copy or a later copy and still retain the same maximum number of lines. Both scripts require the same count of insertions and removals. A deterministic tool must choose one path consistently, disclose that choice, and avoid presenting the selected alignment as knowledge of where the author moved or edited content.

Equal-length paths need a tie-break

Consider original lines `A, B` and revised lines `B, A`. Only one line can remain in order. Matching `A` yields one addition and one removal; matching `B` yields the same cost. TextDiff consults the LCS table and, when removal and insertion lead to equally long remaining matches, consumes the original removal first. The documented tuple therefore removes `A`, retains `B`, and adds `A`. Running the same inputs again gives the same ordered records on every supported route.

A line diff does not prove a move

A person may recognize that a paragraph moved, but the first release deliberately has no moved-block detector. Its atomic language is retained, removed and added. Pairing a removed block with a similar added block would require another similarity threshold, another alignment pass and more ambiguous choices. TextDiff keeps the smaller promise visible. Adjacent red and green records may be presented as a convenient changed block, yet the data model remains insertion and removal so counts and copy output stay exact.

Use context when alignment matters

Repeated headings, braces, blank lines and boilerplate are common in source and documents. A shortest script can align those repeated tokens away from the location a reviewer expected. Read the unchanged lines around each block, compare the original and revised line numbers, and switch to smaller sections when a long repeated document is hard to follow. Do not interpret one selected alignment as proof of authorship, copying, legal effect or semantic equivalence. It is a reproducible syntactic path through two ordered sequences.