Documentation
¶
Index ¶
- func RenderBinaryFile(styles Styles, width int) string
- func RenderDiff(parsed ParsedDiff, filename string, styles Styles, t theme.Theme, width int) string
- func RenderNewFile(content, filename string, styles Styles, t theme.Theme, width int) string
- func RenderNewFileSplit(content, filename string, styles Styles, t theme.Theme, width int) string
- func RenderSplitDiff(parsed ParsedDiff, filename string, styles Styles, t theme.Theme, width int) string
- type DiffLine
- type DiffLineType
- type LogModel
- type Model
- type ParsedDiff
- type SplitLine
- type Styles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderBinaryFile ¶
RenderBinaryFile renders a placeholder for binary files.
func RenderDiff ¶
RenderDiff renders parsed diff lines into a styled string.
func RenderNewFile ¶
RenderNewFile renders file content as an all-added diff (for untracked files).
func RenderNewFileSplit ¶ added in v1.1.0
RenderNewFileSplit renders untracked file content in split layout (all-added on right).
func RenderSplitDiff ¶ added in v1.1.0
func RenderSplitDiff(parsed ParsedDiff, filename string, styles Styles, t theme.Theme, width int) string
RenderSplitDiff renders parsed diff in side-by-side layout.
Types ¶
type DiffLine ¶
type DiffLine struct {
Type DiffLineType
Content string
OldNum int // -1 if N/A
NewNum int // -1 if N/A
}
DiffLine is a single parsed line from a unified diff.
type DiffLineType ¶
type DiffLineType int
DiffLineType classifies a line in a unified diff.
const ( LineContext DiffLineType = iota LineAdded LineRemoved LineHunkHeader LineFileHeader )
type LogModel ¶
type LogModel struct {
// contains filtered or unexported fields
}
LogModel is the Bubble Tea model for the commit log browser.
func NewLogModel ¶
NewLogModel creates the log browser model.
type Model ¶
type Model struct {
SelectedFile string // set on "open in editor" action, read after Run()
// contains filtered or unexported fields
}
Model is the main Bubble Tea model for the diff viewer.
func NewModel ¶
func NewModel( repo *git.Repo, cfg config.Config, changes []git.FileChange, untracked []string, styles Styles, t theme.Theme, stagedOnly bool, ref string, ) Model
NewModel creates the main diff viewer model.
func (*Model) StartInCommitMode ¶
func (m *Model) StartInCommitMode()
StartInCommitMode sets the model to open directly in commit mode.
type ParsedDiff ¶
ParsedDiff is the result of parsing a raw unified diff.
func ParseDiff ¶
func ParseDiff(raw string) ParsedDiff
ParseDiff parses raw unified diff output into structured lines.
type SplitLine ¶ added in v1.1.0
type SplitLine struct {
Left *DiffLine // nil = blank padding
Right *DiffLine // nil = blank padding
}
SplitLine pairs left (old) and right (new) sides for side-by-side display.
type Styles ¶
type Styles struct {
// File list
FileItem lipgloss.Style
FileSelected lipgloss.Style
StagedIcon lipgloss.Style
// File status colors
StatusModified lipgloss.Style
StatusAdded lipgloss.Style
StatusDeleted lipgloss.Style
StatusRenamed lipgloss.Style
StatusUntracked lipgloss.Style
// Diff
DiffAdded lipgloss.Style
DiffRemoved lipgloss.Style
DiffAddedBg lipgloss.Style // bg-only, for padding highlighted lines
DiffRemovedBg lipgloss.Style // bg-only, for padding highlighted lines
DiffContext lipgloss.Style
DiffHunkHeader lipgloss.Style
DiffLineNum lipgloss.Style
DiffLineNumAdded lipgloss.Style
DiffLineNumRemoved lipgloss.Style
// Chrome
HeaderBar lipgloss.Style
StatusBar lipgloss.Style
HelpKey lipgloss.Style
HelpDesc lipgloss.Style
CardBg lipgloss.Style
// Commit input
CommitInput lipgloss.Style
// Accent
Accent lipgloss.Style
}
Styles holds all lipgloss styles derived from a theme.