ui

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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
	TreeBg     string // file tree pane background
	DiffBg     string // diff pane background
	StatusFg   string // status bar foreground
	StatusBg   string // status bar 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) 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
	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