Module
poke/diff
src/poke/diff.pookaFind the changes before drawing a frame around them.
Small and medium documents use a bounded longest-common-subsequence table, so separated edits keep their shared lines. Above 40,000 table cells a linear prefix/suffix fallback avoids quadratic memory. Both views retain real line numbers. Final-newline changes are explicit, never phantom empty lines.
API reference
enum Kind
Kind.Context
Kind.Removed
Kind.Added
Kind.Gap
Kind.Ending
enum View
View.Unified
View.Split
class Line(kind: Kind, old: Option(Int), fresh: Option(Int), text: String)
kind: Kind
poke/diff.Kindold: Option(Int)
Option(Int)fresh: Option(Int)
Option(Int)text: String
String
fn(poke/diff.Kind, Option(Int), Option(Int), String) -> poke/diff.Lineclass Comparison(lines: List(Line), added: Int, removed: Int, is_new: Bool)
lines: List(Line)
List(poke/diff.Line)added: Int
Intremoved: Int
Intis_new: Bool
Bool
fn(List(poke/diff.Line), Int, Int, Bool) -> poke/diff.Comparisoncompare(before: Option(String), after: String) -> Comparison
fn(Option(String), String) -> poke/diff.ComparisonAnalyse without formatting, useful to callers that want their own renderer.
compact(lines: List(Line)) -> List(Line)
fn(List(poke/diff.Line)) -> List(poke/diff.Line)Hide long unchanged runs, preserving three context lines beside each change.
render(before: Option(String), after: String, mode: Mode) -> String
fn(Option(String), String, poke/palette.Mode) -> StringA single aligned gutter keeps each number beside its change marker. Removed rows use the old number; added and shared rows use the new one.
render_with(
before: Option(String),
after: String,
view: View,
width: Int,
mode: Mode
) -> String
fn(Option(String), String, poke/diff.View, Int, poke/palette.Mode) -> StringSplit rendering remains available to callers, but the interactive reviewer always uses the single-column layout.
render_candidate(text: String, width: Int, mode: Mode) -> String
fn(String, Int, poke/palette.Mode) -> StringHiding the diff shows the complete candidate, rather than a blank panel.