ui

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blamer added in v0.12.0

type Blamer interface {
	FileBlame(ref, file string, staged bool) (map[int]diff.BlameLine, error)
}

Blamer provides git blame information for files.

type Colors

type Colors struct {
	Accent     string // active pane borders, dir names
	Border     string // inactive pane borders
	Normal     string // file entries, context lines
	Muted      string // divider lines, status bar
	SelectedFg string // selected file text
	SelectedBg string // selected file background
	Annotation string // annotation text and markers
	CursorFg   string // diff cursor indicator foreground
	CursorBg   string // diff cursor line background
	AddFg      string // added line foreground
	AddBg      string // added line background
	RemoveFg   string // removed line foreground
	RemoveBg   string // removed line background
	ModifyFg   string // modified line foreground (collapsed mode)
	ModifyBg   string // modified line background (collapsed mode)
	TreeBg     string // file tree pane background
	DiffBg     string // diff pane background
	StatusFg   string // status bar foreground
	StatusBg   string // status bar background
	SearchFg   string // search match foreground
	SearchBg   string // search match background
}

Colors holds hex color values (#rrggbb) for TUI rendering.

type Model

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

Model is the top-level bubbletea model for revdiff.

func NewModel

func NewModel(renderer Renderer, store *annotation.Store, highlighter SyntaxHighlighter, cfg ModelConfig) Model

NewModel creates a new Model with the given renderer, store, highlighter and configuration.

func (Model) Discarded added in v0.3.0

func (m Model) Discarded() bool

Discarded returns true when the user chose to discard annotations and quit.

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model by loading changed files.

func (Model) Store

func (m Model) Store() *annotation.Store

Store returns the annotation store for reading results after quit.

func (Model) Update

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

Update handles messages and updates the model state.

func (Model) View

func (m Model) View() string

View renders the full TUI.

type ModelConfig

type ModelConfig struct {
	Ref              string
	Staged           bool
	TreeWidthRatio   int
	TabWidth         int            // number of spaces per tab character
	NoColors         bool           // disable all colors including syntax highlighting
	NoStatusBar      bool           // hide the status bar
	NoConfirmDiscard bool           // skip confirmation prompt when discarding annotations
	Wrap             bool           // enable line wrapping
	Collapsed        bool           // start in collapsed diff mode
	LineNumbers      bool           // show line numbers in diff gutter
	ShowBlame        bool           // show blame gutter on startup when available
	Only             []string       // show only these files (match by exact path or path suffix)
	WorkDir          string         // working directory for resolving absolute --only paths
	Keymap           *keymap.Keymap // custom key bindings (nil uses defaults)
	Blamer           Blamer         // optional blame provider (nil when git unavailable)
	Colors           Colors
}

ModelConfig holds configuration options for NewModel.

type Renderer

type Renderer interface {
	ChangedFiles(ref string, staged bool) ([]string, error)
	FileDiff(ref, file string, staged bool) ([]diff.DiffLine, error)
}

Renderer provides methods to extract changed files and build full-file diff views.

type SyntaxHighlighter

type SyntaxHighlighter interface {
	HighlightLines(filename string, lines []diff.DiffLine) []string
}

SyntaxHighlighter provides syntax highlighting for diff lines.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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