// Docs

Comparison rules

What makes two things equal, how important and unimportant differences work, and how lines are aligned.

Every session compares by rules, and the rules come from three places, in this order:

  1. The format’s defaults — what a Rust file, a CSV or a PNG starts with.
  2. The session’s rules — ⌘; (Ctrl+Alt+Shift+S) opens them. The dialog’s top strip switches between “This session” and “Defaults”, and “Save as defaults” copies what you have set into the defaults for every new session of that type.
  3. A one-off override — mark one difference unimportant, align two lines by hand, ignore a column. These live in the session and are listed in the rules dialog, where they can be removed again.

Important and unimportant differences

Both are shown; the difference is what they mean. A file whose differences are all unimportant counts as the same, is marked ≈ in a folder comparison, and lets --quick=rules return “same by the rules” (exit code 2) rather than “binary same” (1).

In a text comparison an unimportant difference is drawn in the modified colour at 70%: the line background and the changed words are the same, only paler, with no outline and no underline. It is a quieter version of the same thing, not a different thing.

What is unimportant is yours to say. The “Importance” page lists the grammar elements of the file’s format — comments, strings, numbers, identifiers, whitespace, line endings and the rest — each with an example from the file in front of you and the number of differences it takes part in, and each switchable between important and unimportant. Beside them: elements you define by regular expression, columns to ignore (from–to), page headers and footers, and the ranges you marked by hand in the comparison.

The counts are recalculated as you click, and the footer says what will happen: “After OK, recompare: important differences 7 → 5”.

Replacements

Two files can be equal after a substitution that is not a real difference to you: a renamed identifier, a changed path, a version number. The “Replace” page holds a list of them (plain text, whole word, case-sensitive, or a regular expression with $1 groups), each switchable on and off, and “Treat renamed identifiers as unimportant” adds the rename it detects by itself. The preview shows four real line pairs from the file and whether their differences become unimportant.

Alignment

Which line pairs with which is a choice, not a fact. The “Alignment” page offers the algorithm (Histogram, Patience, Myers, Minimal), whether similar lines are aligned at all, how lines are weighted (by length or by grammar) and a length above which a line is skipped, with a live preview of a sample pair under the current settings.

In the comparison itself, “Align with” pairs two lines you choose and “Isolate” breaks a pair apart; both are listed in the dialog and can be removed. Aligned lines are marked beside the line numbers, and the default drawing keeps both sides scrolling freely with a connector curving between each pair.

Folders

A folder comparison decides “same” by the criteria you pick: timestamp (with a tolerance, daylight-saving and time-zone offsets handled), size, name case, attributes, and contents — by CRC, byte for byte, by the file’s own rules, or by version information. The filters are names (include and exclude, semicolon separated), size, time, contents and attributes, and “Flatten” drops the folder structure so that only the files are matched.

Alignment has its own page there too: different extensions that belong together, wildcards, Unicode normalisation, and a per-item “Align with an item on the other side”.

Encodings and line endings

Each side’s encoding is detected and can be forced; the preview decodes the file’s real bytes with the chosen encoding, so a wrong choice shows mojibake instead of failing quietly. On save, the byte order mark can be kept, removed or added, and line endings kept or changed to LF, CRLF or CR. Line endings that differ are a difference like any other — and like any other, you can make it unimportant.

Last updated: 2026-11-22