This page covers File ▸ Compare With…, which aligns the current document and another file line by line in the Compare window and steps through the differences with Previous and Next. It also covers Copy Left and Copy Right, which carry a change from one side to the other, the Ignore Whitespace and Ignore Case options, Save Report… for a plain-text report of the differences, and the limits of a comparison. The comparison itself is Caxton Free, and Copy Left, Copy Right and Save Report… are Caxton Pro.
Side by side
The comparison aligns the current document and any other file line by line and scrolls them as one: both panes live in a single view, so they cannot drift. Changed pairs, left-only lines and right-only lines each get their own tint, taken from the current theme's palette. ⌘↓ and ⌘↑ step through the differences, and clicking a change selects it.
A log compared against a modified copy: aligned rows, tinted changes, the current difference outlined.
The Compare window
The window's title names both sides (Compare: left ↔ right). The bar across the top holds, from left to right: Previous and Next (⌘↑ and ⌘↓), a counter of the current difference and the total, Copy Left, Copy Right, the Ignore Whitespace and Ignore Case options, Save Report…, and a note in orange when there is something to flag, such as a side truncated at the size limit (the note reads left side truncated at or right side truncated at, followed by the limit).
The window follows the theme, and the panes use the editor's font and zoom.
The window takes the current theme, as the editor does, and switches with it while it is open. The panes draw in the editor's font at the editor's zoom, so ⌘+ and ⌘− in a document resize the comparison too.
If the other file cannot be read, Couldn't compare names it and no window opens.
Copy changes across
Click a difference to select it, then copy it left or right. Copy Left replaces the selected change in the open document with the right side's lines, as one undo step in that document. Copy Right works when the other file is open in Caxton too. Copy Left and Copy Right are Caxton Pro, because they copy lines from one file into the other.
- A file that is open in Caxton compares as its live text, unsaved edits included and labeled. Copies land in its buffer, never silently on disk.
- After a copy the panes recompute, and a comparison left open catches up when you come back to it after editing either document.
- A copy attempted during a save is refused with a notice to try again in a moment, and a copy waits for the alignment it belongs to.
Ignore case and whitespace
Ignore Whitespace collapses indentation and spacing differences. Ignore Case folds A to Z; accented case stays significant. Line terminators are not compared, so a file and its CRLF-converted copy report no differences, and the window adds a note with both conventions when the two sides use different line endings. CR-only files compare line by line.
Saved reports
Save Report… writes the differences as plain text: one @@ header per change with the left and right line numbers, minus and plus lines below it. The report stops at 20,000 changed rows, and a report that stops there ends with the line [report truncated at 20000 changed rows]. If the report cannot be written, for example to a read-only folder or a full disk, Couldn't save the report gives the reason. Saving the report is Caxton Pro. The comparison itself is Caxton Free.
Limits
- Copy is limited to 64 MB. Copy works only on fully captured sides and refuses a block over 64 MB.
- Each side is compared up to 256 MB, and a larger file gets the orange truncation note. To compare larger files, split both by size with File ▸ Split File… and compare the parts in pairs with File ▸ Compare With…. Beyond the edit-distance budget, distant changes collapse into a single block rather than an unbounded search.
- A target that changes on disk is flagged when you return to the comparison.
The external-change prompt also offers Compare, so you can see the difference before choosing which version to keep. The comparison window reads under VoiceOver.