diffview

package
v0.0.0-...-edbbb69 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloseDiffViewMsg

type CloseDiffViewMsg struct{}

CloseDiffViewMsg is sent when the diff view should be closed.

type DiffDataLoadedMsg

type DiffDataLoadedMsg struct {
	Files []git.FileDiff
	Stats *git.CommitOverview
	Err   error
}

DiffDataLoadedMsg is sent when diff data has been loaded.

type DiffSource

type DiffSource struct {
	Kind   git.DiffKind
	Path   string // for single-file diffs
	Commit string // for commit diffs (full hash)
	Range  string // for range diffs e.g. "main..feature"
	Stash  string // for stash diffs e.g. "stash@{0}"
}

DiffSource describes what is being diffed.

type HunkStagedMsg

type HunkStagedMsg struct {
	Err error
}

HunkStagedMsg is sent after a hunk has been staged or unstaged.

type KeyMap

type KeyMap struct {
	// Navigation
	MoveDown     key.Binding
	MoveUp       key.Binding
	PageDown     key.Binding
	PageUp       key.Binding
	HalfPageDown key.Binding
	HalfPageUp   key.Binding
	GoToTop      key.Binding
	GoToBottom   key.Binding

	// Hunk navigation
	NextHunk       key.Binding
	PrevHunk       key.Binding
	NextHunkHeader key.Binding
	PrevHunkHeader key.Binding

	// File navigation
	NextFile key.Binding
	PrevFile key.Binding

	// Actions
	StageHunk   key.Binding
	UnstageHunk key.Binding

	// Horizontal scroll
	ScrollLeft  key.Binding
	ScrollRight key.Binding
	ScrollStart key.Binding
	ScrollEnd   key.Binding

	// Toggle fold
	Toggle key.Binding

	// Close
	Close       key.Binding
	CloseEscape key.Binding
}

KeyMap defines key bindings for the diff view.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default key bindings for the diff view.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the diff view model for displaying diffs.

func New

func New(repo *git.Repository, source DiffSource, cfg *config.Config, tokens theme.Tokens) Model

New creates a new diff view model.

func (Model) Done

func (m Model) Done() bool

Done returns whether the view should be closed.

func (Model) Init

func (m Model) Init() tea.Cmd

Init implements tea.Model.

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize updates the view dimensions.

func (Model) Source

func (m Model) Source() DiffSource

Source returns the diff source.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (Model) View

func (m Model) View() string

View implements tea.Model.

type OpenDiffViewMsg

type OpenDiffViewMsg struct {
	Source DiffSource
}

OpenDiffViewMsg triggers opening the diff view at the app level.

Jump to

Keyboard shortcuts

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