diffview

package
v0.4.54-beta Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package diffview renders structured unified diffs consistently across Kodelet surfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderedText

func RenderedText(lines []RenderedLine) string

Types

type FileDiff

type FileDiff struct {
	Path      string
	MovePath  string
	Operation string
	Added     int
	Removed   int
	Lines     []Line
}

func FromApplyPatchChange

func FromApplyPatchChange(change tooltypes.ApplyPatchChange) FileDiff

func (FileDiff) DisplayPath

func (f FileDiff) DisplayPath() string

func (FileDiff) Header

func (f FileDiff) Header() string

func (FileDiff) OperationLabel

func (f FileDiff) OperationLabel() string

type Line

type Line struct {
	Kind    LineKind
	OldLine int
	NewLine int
	Content string
}

type LineKind

type LineKind string
const (
	LineContext LineKind = "context"
	LineAdded   LineKind = "added"
	LineRemoved LineKind = "removed"
	LineHeader  LineKind = "header"
	LineMeta    LineKind = "meta"
	LinePlain   LineKind = "plain"
)

type RenderedLine

type RenderedLine struct {
	Kind LineKind
	Text string
}

func RenderFileBody

func RenderFileBody(file FileDiff) []RenderedLine

func RenderFileBodyWidth

func RenderFileBodyWidth(file FileDiff, width int) []RenderedLine

func RenderSummary

func RenderSummary(summary Summary) []RenderedLine

func RenderSummaryWidth

func RenderSummaryWidth(summary Summary, width int) []RenderedLine

type Summary

type Summary struct {
	Files   []FileDiff
	Added   int
	Removed int
}

func FromApplyPatchMetadata

func FromApplyPatchMetadata(meta tooltypes.ApplyPatchMetadata) Summary

Jump to

Keyboard shortcuts

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