Module

poke/diff

src/poke/diff.pooka

Find 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

src/poke/diff.pooka:17
enum Kind
variant

Context

src/poke/diff.pooka:18
Kind.Context
variant

Removed

src/poke/diff.pooka:19
Kind.Removed
variant

Added

src/poke/diff.pooka:20
Kind.Added
variant

Gap

src/poke/diff.pooka:21
Kind.Gap
variant

Ending

src/poke/diff.pooka:22
Kind.Ending
enum

View

src/poke/diff.pooka:25
enum View
variant

Unified

src/poke/diff.pooka:26
View.Unified
variant

Split

src/poke/diff.pooka:27
View.Split
class

Line

src/poke/diff.pooka:30
class Line(kind: Kind, old: Option(Int), fresh: Option(Int), text: String)
field

kind

src/poke/diff.pooka:30
kind: Kind
field

old

src/poke/diff.pooka:30
old: Option(Int)
INFERREDOption(Int)
field

fresh

src/poke/diff.pooka:30
fresh: Option(Int)
INFERREDOption(Int)
field

text

src/poke/diff.pooka:30
text: String
INFERREDString
constructor

new

src/poke/diff.pooka:30
INFERREDfn(poke/diff.Kind, Option(Int), Option(Int), String) -> poke/diff.Line
class

Comparison

src/poke/diff.pooka:32
class Comparison(lines: List(Line), added: Int, removed: Int, is_new: Bool)
field

lines

src/poke/diff.pooka:32
lines: List(Line)
INFERREDList(poke/diff.Line)
field

added

src/poke/diff.pooka:32
added: Int
INFERREDInt
field

removed

src/poke/diff.pooka:32
removed: Int
INFERREDInt
field

is_new

src/poke/diff.pooka:32
is_new: Bool
INFERREDBool
constructor

new

src/poke/diff.pooka:32
INFERREDfn(List(poke/diff.Line), Int, Int, Bool) -> poke/diff.Comparison
function

compare

src/poke/diff.pooka:35
compare(before: Option(String), after: String) -> Comparison
INFERREDfn(Option(String), String) -> poke/diff.Comparison

Analyse without formatting, useful to callers that want their own renderer.

function

compact

src/poke/diff.pooka:254
compact(lines: List(Line)) -> List(Line)
INFERREDfn(List(poke/diff.Line)) -> List(poke/diff.Line)

Hide long unchanged runs, preserving three context lines beside each change.

function

render

src/poke/diff.pooka:321
render(before: Option(String), after: String, mode: Mode) -> String
INFERREDfn(Option(String), String, poke/palette.Mode) -> String

A single aligned gutter keeps each number beside its change marker. Removed rows use the old number; added and shared rows use the new one.

function

render_with

src/poke/diff.pooka:327
render_with(
  before: Option(String),
  after: String,
  view: View,
  width: Int,
  mode: Mode
) -> String
INFERREDfn(Option(String), String, poke/diff.View, Int, poke/palette.Mode) -> String

Split rendering remains available to callers, but the interactive reviewer always uses the single-column layout.

function

render_candidate

src/poke/diff.pooka:354
render_candidate(text: String, width: Int, mode: Mode) -> String
INFERREDfn(String, Int, poke/palette.Mode) -> String

Hiding the diff shows the complete candidate, rather than a blank panel.