textdiff

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package textdiff renders compact previews of text mutations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasChanges

func HasChanges(preview Preview) bool

func LineStats

func LineStats(preview Preview) (added, removed int)

Types

type OpKind

type OpKind string
const (
	OpContext OpKind = "context"
	OpDelete  OpKind = "delete"
	OpInsert  OpKind = "insert"
	OpSkip    OpKind = "skip"
)

type Preview

type Preview struct {
	OldStartLine int         `json:"old_start_line,omitempty"`
	NewStartLine int         `json:"new_start_line,omitempty"`
	Ops          []PreviewOp `json:"ops,omitempty"`
}

func BuildPreview

func BuildPreview(before, after string, contextLines int) Preview

func (Preview) Valid

func (p Preview) Valid() bool

type PreviewOp

type PreviewOp struct {
	Kind OpKind `json:"kind,omitempty"`
	Text string `json:"text,omitempty"`
}

Jump to

Keyboard shortcuts

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