Documentation
¶
Overview ¶
Package textdiff renders a bounded, hand-rolled unified line diff (stdlib only, no diff library). It backs `mesh conflicts diff` and `mesh curator show`, which show a parked loser against the current note. Bounded by design: it refuses to run the O(n*m) LCS on very large inputs, degrading to a line-count summary so a hostile or huge note cannot hang the CLI. Reusable by a future TUI view.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sanitize ¶
Sanitize replaces C0/C1 control bytes (except tab) with the Unicode replacement char so untrusted note content cannot inject ANSI escapes, cursor moves, or a fake prompt when the diff is printed to a real terminal. Exported so callers can scrub hub-supplied labels (e.g. a note path) the same way.
Types ¶
type Options ¶
type Options struct {
Context int // equal lines of context around a change (default 3)
Full bool // emit the whole file as one hunk, not just changed regions
MaxLines int // cap on emitted +/- lines before truncating (default 400)
Color bool // ANSI-color the +/- lines (the caller gates this on a TTY)
}
Options tunes Unified. Zero values are sensible (3 lines of context, a 400 changed-line cap, no color, hunks only).