diffview

package
v0.0.0-...-6d55746 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 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 Model

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

Model represents the diff view component

func New

func New() Model

New creates a new diff view model

func (*Model) Clear

func (m *Model) Clear()

Clear clears the diff view

func (Model) FilePath

func (m Model) FilePath() string

FilePath returns the current file path

func (Model) GetSearchableLines

func (m Model) GetSearchableLines() []SearchableLine

GetSearchableLines returns lines for searching based on current view mode

func (Model) GetViewMode

func (m Model) GetViewMode() string

GetViewMode returns the current view mode as a string

func (Model) Init

func (m Model) Init() tea.Cmd

Init implements tea.Model

func (Model) IsFocused

func (m Model) IsFocused() bool

IsFocused returns whether this component is focused

func (*Model) JumpToLine

func (m *Model) JumpToLine(idx int)

JumpToLine jumps to a specific line index

func (*Model) SetDiff

func (m *Model) SetDiff(diff *git.FileDiff, filePath string)

SetDiff sets the diff to display

func (*Model) SetFocused

func (m *Model) SetFocused(focused bool)

SetFocused sets whether this component is focused

func (*Model) SetSize

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

SetSize sets the dimensions

func (Model) Update

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

Update implements tea.Model

func (Model) View

func (m Model) View() string

View implements tea.Model

type SearchableLine

type SearchableLine struct {
	LineNum int
	Content string
	Type    string
	OrigIdx int
}

SearchableLine represents a line that can be searched

type SideBySideLine

type SideBySideLine struct {
	OldLineNum int
	OldContent string
	OldType    git.DiffLineType
	NewLineNum int
	NewContent string
	NewType    git.DiffLineType
}

SideBySideLine represents a line in the side-by-side view

type ViewMode

type ViewMode int

ViewMode represents the diff view mode

const (
	ViewBoth ViewMode = iota // Side-by-side (default)
	ViewNew                  // Only new/added content
	ViewOld                  // Only old/deleted content
)

Jump to

Keyboard shortcuts

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