Skip to content

ratatui-diff

A navigable unified and split diff widget for Ratatui. Show text comparisons or Git patches with line numbers, word highlights, folding, search, and source-accurate selection.
Split view of a Rust change: the old timeout and retry count on the left, their replacements and an added backoff line on the right, with changed words emphasized.
[dependencies]
ratatui-diff = "0.1"

Any input

Compare two strings, parse unified or multi-file Git patches, or supply structured files and hunks. See Choose an input.

Unified or split

Switch layouts without losing your place. Wrap long lines, show whitespace, hide numbers, and choose a theme. See Appearance.

Built for review

Jump by hunk or file, search source, fold files and unchanged context, and keep the current file header visible. See Navigation and Folding.

Exact source

Selection copies the original bytes, never gutters or padding. Hit-testing maps terminal cells back to file, side, line, and byte. See Selection.

Optional syntax colors

Enable the syntax feature for bundled grammars and themes, composed underneath diff styling. See Syntax colors.

You own the app

Rendering depends only on ratatui-core. Your application keeps terminal setup, key bindings, files, and repository access.

The bundled viewer example cycles through unified view, split view, and visible whitespace. Run it with cargo run --example viewer.

Animated capture of the example viewer switching from unified view to split view and then turning on whitespace markers.