Documentation
¶
Overview ¶
Package diffview presents captured diff navigation and provisional live cards. Preview snapshots are observations, never completed edit evidence.
Index ¶
- Constants
- func CallerStyle(theme livediff.Theme) func(string) (string, string)
- func Callers(view *livediff.View) []string
- func CountStats(count livediff.Counts, theme livediff.Theme) string
- func FileLabel(status Status, label, workspace string, theme livediff.Theme) string
- func PreviewBirths(before, after []PreviewRow, born []time.Time, now time.Time) []time.Time
- type ChangeRow
- type ChangeTarget
- type NavEntry
- type Navigation
- type Preview
- type PreviewMotion
- type PreviewPane
- func (p *PreviewPane) Animating(now time.Time) bool
- func (p *PreviewPane) Callers() []string
- func (p *PreviewPane) ExpireBatches(now time.Time, hold time.Duration) bool
- func (p *PreviewPane) Live() int
- func (p *PreviewPane) NextBatch(caller string) bool
- func (p *PreviewPane) Render(ctx context.Context, workspace string, theme livediff.Theme, width, height int) ([]string, error)
- func (p *PreviewPane) RenderBatch(ctx context.Context, caller, workspace string, theme livediff.Theme, ...) ([]string, error)
- func (p *PreviewPane) Scroll(key byte) bool
- func (p *PreviewPane) ScrollBatch(caller string, key byte) bool
- func (p *PreviewPane) Update(preview Preview)
- type PreviewRow
- type PreviewView
- type Status
Constants ¶
const ( PreviewFrameDelay = 33 * time.Millisecond PreviewMaxStagger = 96 * time.Millisecond // Keep consecutive target units visually distinct: the next unit starts // after the preceding unit's last row has finished fading in. PreviewUnitDelay = liveDiffPreviewFade + PreviewMaxStagger // A finished call keeps distinct unit reveals only this long before its // remaining input is shown at once. PreviewFinishDrain = time.Second )
const ( PreviewEdit = "edit" PreviewRunning = "running" PreviewPending = "pending" )
Preview status names what a card shows; the viewer renders the state.
Variables ¶
This section is empty.
Functions ¶
func CallerStyle ¶
CallerStyle is how the diff presents a canonical agent path.
func CountStats ¶
CountStats shows known line counts; unknown counts are not zero.
func FileLabel ¶
FileLabel prefixes a file label with its colored status; a rename also names its source. Every file row (tree, flat list, Changes tab, streaming title) uses this format.
func PreviewBirths ¶
PreviewBirths carries reveal times across a snapshot. Unchanged rows and rows that only grew keep theirs, so a streaming line does not restart its fade; newly revealed rows cascade in order.
Types ¶
type ChangeTarget ¶
type ChangeTarget struct{ Change, File string }
type Navigation ¶
type Navigation struct {
Navigation is a presentation index. Capture order and evidence stay owned by View.
func (*Navigation) EnsureVisible ¶
func (n *Navigation) EnsureVisible(rows int)
func (*Navigation) Width ¶
func (n *Navigation) Width(width int) int
type Preview ¶
type Preview struct {
ID string
Workspace string
Caller string
Turn string `json:",omitzero"`
Thread string
Files []mekugi.ReviewFile
Input string // Display-only text, never executed.
Truncated bool
Evaluated bool `json:",omitzero"`
Complete bool `json:",omitzero"`
DiffText bool `json:",omitzero"`
Status string
Tool string `json:",omitempty"` // The evidenced editing tool, not its host executor.
}
Preview state is router-lifetime only and never enters the replay store.
type PreviewMotion ¶
Motion is display-only. Without it, rows appear at their final colors.
type PreviewPane ¶
type PreviewPane struct {
Views map[string]*PreviewView
Order []string
Motion PreviewMotion
Retain bool // Native edit batches retain completed calls until their individual holds expire.
// A dock too short for every call keeps one card open and folds the rest
// to their headings. Prefer names the caller whose card opens first.
Prefer string
Accordion bool // The last frame folded cards.
Compact bool // Keep concurrent cards folded even when an even split fits.
// contains filtered or unexported fields
}
Previews have their own viewport and lifecycle. They never change the captured diff's selection, scroll, acknowledgements, or follow mode. Updates replace snapshots; only a displayed frame parses and lays out rows.
func (*PreviewPane) Animating ¶
func (p *PreviewPane) Animating(now time.Time) bool
animating reports whether a displayed row is still fading in.
func (*PreviewPane) Callers ¶
func (p *PreviewPane) Callers() []string
callers counts distinct callers with a card, for the dock heading.
func (*PreviewPane) ExpireBatches ¶
ExpireBatches retires each completed call after its own settling interval. Running siblings and newer edits must not retain an older completed call.
func (*PreviewPane) Live ¶
func (p *PreviewPane) Live() int
live counts calls whose input is still streaming.
func (*PreviewPane) NextBatch ¶
func (p *PreviewPane) NextBatch(caller string) bool
func (*PreviewPane) RenderBatch ¶
func (p *PreviewPane) RenderBatch(ctx context.Context, caller, workspace string, theme livediff.Theme, width, height, minRows int) ([]string, error)
RenderBatch uses a newest-following window rather than shrinking older files. Cycling pins that window, so arriving edits never steal a manual selection. minRows includes the file heading. A smaller terminal shows only a summary.
func (*PreviewPane) Scroll ¶
func (p *PreviewPane) Scroll(key byte) bool
A manual stream scroll pauses each visible card; new input still replaces its snapshot, without moving its source window. r restores each card's live tip.
func (*PreviewPane) ScrollBatch ¶
func (p *PreviewPane) ScrollBatch(caller string, key byte) bool
ScrollBatch moves only the displayed file windows, independently of transcripts and captured diffs. Resuming follow also releases the manually pinned window.
func (*PreviewPane) Update ¶
func (p *PreviewPane) Update(preview Preview)
type PreviewRow ¶
type PreviewView ¶
type PreviewView struct {
Current Preview
Complete bool
Rendered Preview
Focus int
Paused bool
ScrollRow int
Source []PreviewRow
Fading time.Time // Until a displayed row finishes fading in.
// contains filtered or unexported fields
}
Each call owns its source window, syntax cache, and completion state.
func (*PreviewView) Render ¶
func (p *PreviewView) Render(ctx context.Context, workspace string, theme livediff.Theme, width, height int, motion PreviewMotion) ([]string, error)
Render and color only a bounded source window around the streaming tip. Captured history composition stays out of this high-frequency path.
type Status ¶
type Status struct {
Before, After string
// Edited reports captured content changes, not missing evidence.
Edited, Conflict bool
Incomplete bool
Directory bool
}
Status is a file row's net change, coded like git's short status: ? (incomplete evidence), A, D, M, R (rename only), RM (rename with edits), or UU (the net diff still adds conflict markers that mchanges revert or apply left for resolution).
func StatusOf ¶
func StatusOf(regions ...mekugi.ReviewFile) Status
StatusOf classifies a file's diff regions, in capture order.
func (*Status) Add ¶
func (s *Status) Add(region mekugi.ReviewFile)
add folds a later capture of the file into its status; before stays the first capture's.