diffparse

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	Unified    []UnifiedRow
	SideBySide []SideBySideRow
	OldMaxLine int
	NewMaxLine int
	UnifiedOld int
	UnifiedNew int
}

func ParseUnified

func ParseUnified(r io.Reader) (*Document, error)

ParseUnified parses a unified diff (for a single file) into: - Unified rows (default rendering) - Side-by-side rows (optional toggle)

The parser intentionally omits diff metadata and hunk headers so the UI matches diffnav's content-first style.

type Kind

type Kind uint8
const (
	KindSeparator Kind = iota
	KindContext
	KindAdd
	KindDelete
	KindModify // side-by-side only (paired delete+add)
)

type SideBySideRow

type SideBySideRow struct {
	Kind    Kind
	OldLine int
	NewLine int
	OldText string
	NewText string
}

type UnifiedRow

type UnifiedRow struct {
	Kind    Kind
	OldLine int
	NewLine int
	Text    string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL