Documentation
¶
Overview ¶
Package diffview renders semantic OpenAPI changes and source lines for terminal views. Callers own source snapshots, source selection, scrolling, and document comparison.
Index ¶
- func RenderChange(ch *changeModel.Change, source Source, width int, styles Styles) string
- func RenderSource(lines []string, highlight Range, changeType, width int, styles Styles) string
- func RenderSummary(ch *changeModel.Change, width int, styles Styles) string
- type Range
- type Side
- type Source
- type Styles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderChange ¶
RenderChange renders a summary followed by bounded physical source context. It never chooses a source document or substitutes coordinates between sides.
func RenderSource ¶
RenderSource renders all physical source lines without wrapping or clipping. It escapes terminal controls. Callers own the viewport and horizontal scrolling.
func RenderSummary ¶
func RenderSummary(ch *changeModel.Change, width int, styles Styles) string
RenderSummary renders a change's action, impact, and detached values. Large values use a marked excerpt; this is not a complete byte diff.
Types ¶
type Range ¶
type Range struct{ Start, End int }
Range identifies inclusive physical source lines, starting at one.
func RangeForChange ¶
func RangeForChange(lines []string, line int, ch *changeModel.Change) Range
RangeForChange locates the changed block in a caller-validated source snapshot.
type Source ¶
Source is source context whose ownership the caller has checked. Line is one-based. A zero Line omits context. External document coordinates must never be paired with root document lines.
type Styles ¶
type Styles struct {
SelectedRow lipgloss.Style
RangeHighlight lipgloss.Style
AddedRow lipgloss.Style
AddedRange lipgloss.Style
RemovedRow lipgloss.Style
RemovedRange lipgloss.Style
Added lipgloss.Style
Modified lipgloss.Style
Removed lipgloss.Style
Breaking lipgloss.Style
Grey lipgloss.Style
Detail lipgloss.Style
YAMLKey lipgloss.Style
}
Styles supplies terminal styles without imposing an application theme. The zero value renders plain text.