Skip to main content

Module diff_view

Module diff_view 

Source
Expand description

Read-only presentation of a diff the caller already computed.

Files, hunks, lines, line identities, old and new line numbers, marks and pre-classified code spans all come from the caller. This module computes no diff, parses no syntax, applies no patch and reads no filesystem.

§One renderer, two arrangements

Unified and split presentation use the same caller-supplied logical rows and the same line-side renderer. For a replacement, the caller supplies the aligned old and new sides: split mode places them opposite one another, while unified mode places them on consecutive fixed rows. The component never guesses which removal belongs with which addition.

§Large data

The hierarchy is flattened once per render, which walks all caller-owned files, hunks and lines. The resulting fixed-height rows are handed to the virtualized List, so only viewport rows are laid out or published. The explicit price is the same one paid by virtualized CodeView: long lines are clipped and do not horizontally scroll. This is suitable for a large already-materialized diff, not for lazy diff loading.

Structs§

DiffFile
One caller-supplied file and its hunks.
DiffHunk
One caller-supplied hunk.
DiffLine
One stable, caller-supplied logical diff row.
DiffView
A virtualized, read-only diff presentation.

Enums§

DiffPresentation
How the same caller-supplied lines are arranged.
DiffViewEvent
An action on caller-owned diff identity.