Documentation
¶
Overview ¶
Code generated by enum generator; DO NOT EDIT.
Code generated by enum generator; DO NOT EDIT.
Index ¶
- Variables
- func DirectionIter() func(yield func(Direction) bool)
- func MotionIter() func(yield func(Motion) bool)
- type Direction
- type FileTree
- func (ft *FileTree) EnsureVisible(height int)
- func (ft *FileTree) FileStatus(path string) diff.FileStatus
- func (ft *FileTree) FilterActive() bool
- func (ft *FileTree) HasFile(dir Direction) bool
- func (ft *FileTree) Move(m Motion, count ...int)
- func (ft *FileTree) Rebuild(entries []diff.FileEntry)
- func (ft *FileTree) RefreshFilter(annotatedFiles map[string]bool)
- func (ft *FileTree) Render(r FileTreeRender) string
- func (ft *FileTree) ReviewedCount() int
- func (ft *FileTree) SelectByPath(path string) bool
- func (ft *FileTree) SelectedFile() string
- func (ft *FileTree) StepFile(dir Direction)
- func (ft *FileTree) ToggleFilter(annotatedFiles map[string]bool)
- func (ft *FileTree) ToggleReviewed(path string)
- func (ft *FileTree) TotalFiles() int
- type FileTreeRender
- type Motion
- type Renderer
- type Resolver
- type TOC
- type TOCRender
Constants ¶
This section is empty.
Variables ¶
var ( // zero value sentinel DirectionUnknown = Direction{/* contains filtered or unexported fields */} // forward / next DirectionNext = Direction{/* contains filtered or unexported fields */} // backward / previous DirectionPrev = Direction{/* contains filtered or unexported fields */} )
Public constants for direction values
var ( // zero value sentinel MotionUnknown = Motion{/* contains filtered or unexported fields */} // single step up MotionUp = Motion{/* contains filtered or unexported fields */} // single step down MotionDown = Motion{/* contains filtered or unexported fields */} // page up — uses count[0] from variadic MotionPageUp = Motion{/* contains filtered or unexported fields */} // page down — uses count[0] from variadic MotionPageDown = Motion{/* contains filtered or unexported fields */} // jump to first entry MotionFirst = Motion{/* contains filtered or unexported fields */} // jump to last entry MotionLast = Motion{/* contains filtered or unexported fields */} )
Public constants for motion values
var DirectionNames = []string{
"Unknown",
"Next",
"Prev",
}
DirectionNames contains all possible enum names
var DirectionValues = []Direction{ DirectionUnknown, DirectionNext, DirectionPrev, }
DirectionValues contains all possible enum values
var MotionNames = []string{
"Unknown",
"Up",
"Down",
"PageUp",
"PageDown",
"First",
"Last",
}
MotionNames contains all possible enum names
var MotionValues = []Motion{ MotionUnknown, MotionUp, MotionDown, MotionPageUp, MotionPageDown, MotionFirst, MotionLast, }
MotionValues contains all possible enum values
Functions ¶
func DirectionIter ¶
DirectionIter returns a function compatible with Go 1.23's range-over-func syntax. It yields all Direction values in declaration order. Example:
for v := range DirectionIter() {
// use v
}
func MotionIter ¶
MotionIter returns a function compatible with Go 1.23's range-over-func syntax. It yields all Motion values in declaration order. Example:
for v := range MotionIter() {
// use v
}
Types ¶
type Direction ¶
type Direction struct {
// contains filtered or unexported fields
}
Direction is the exported type for the enum
func MustDirection ¶
MustDirection is like ParseDirection but panics if string is invalid
func ParseDirection ¶
ParseDirection converts string to direction enum value. Parsing is always case-insensitive.
func (Direction) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Direction) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type FileTree ¶
type FileTree struct {
// contains filtered or unexported fields
}
FileTree manages the list of changed files grouped by directory.
func NewFileTree ¶
NewFileTree builds a FileTree from a list of changed file entries. handles entries == nil gracefully, returning a valid empty *FileTree.
func (*FileTree) EnsureVisible ¶
EnsureVisible adjusts offset so the cursor is within the visible range of given height.
func (*FileTree) FileStatus ¶
func (ft *FileTree) FileStatus(path string) diff.FileStatus
FileStatus returns the git change status for the given file path.
func (*FileTree) FilterActive ¶
FilterActive returns true when the file tree is showing only annotated files.
func (*FileTree) HasFile ¶
HasFile returns true if there is a file entry in the given direction from the current cursor position (no wrap-around).
func (*FileTree) Move ¶
Move navigates the cursor according to the given motion. count is variadic: page motions use count[0] for the page size, non-page motions ignore count entirely. Missing count for page motions defaults to 1 (single step), which is harmless.
func (*FileTree) Rebuild ¶
Rebuild rebuilds the file tree from new entries in-place. preserves reviewed map (pruned to files still present), resets cursor/offset, positions cursor on first file entry, and preserves filter state. entries are rebuilt from all files regardless of filter flag; call RefreshFilter afterward when FilterActive returns true.
func (*FileTree) RefreshFilter ¶
RefreshFilter rebuilds the filtered tree if the filter is active, preserving cursor position.
func (*FileTree) Render ¶
func (ft *FileTree) Render(r FileTreeRender) string
Render produces the file tree display string, showing only entries visible within the given height. it adjusts the internal offset so the cursor stays within the visible window.
func (*FileTree) ReviewedCount ¶
ReviewedCount returns the number of files marked as reviewed.
func (*FileTree) SelectByPath ¶
SelectByPath sets the cursor to the file entry matching the given path. returns true if the file was found and cursor moved, false otherwise.
func (*FileTree) SelectedFile ¶
SelectedFile returns the full path of the currently selected file, or empty string if a directory is selected or entries are empty.
func (*FileTree) StepFile ¶
StepFile moves to the next or previous file entry, wrapping around at ends.
func (*FileTree) ToggleFilter ¶
ToggleFilter switches between showing all files and only annotated files.
func (*FileTree) ToggleReviewed ¶
ToggleReviewed toggles the reviewed state of the given file path.
func (*FileTree) TotalFiles ¶
TotalFiles returns the count of original file paths (before filtering).
type FileTreeRender ¶
type FileTreeRender struct {
Width int
Height int
Annotated map[string]bool
Resolver Resolver
Renderer Renderer
}
FileTreeRender holds parameters for FileTree.Render.
type Motion ¶
type Motion struct {
// contains filtered or unexported fields
}
Motion is the exported type for the enum
func MustMotion ¶
MustMotion is like ParseMotion but panics if string is invalid
func ParseMotion ¶
ParseMotion converts string to motion enum value. Parsing is always case-insensitive.
func (Motion) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Motion) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Renderer ¶
type Renderer interface {
FileStatusMark(status diff.FileStatus) string
FileReviewedMark() string
FileAnnotationMark() string
}
Renderer is what sidepane needs for compound ANSI rendering (FileTree only — TOC doesn't use it). satisfied by *style.Renderer via ui's styleRenderer interface.
type Resolver ¶
type Resolver interface {
Style(k style.StyleKey) lipgloss.Style
Color(k style.ColorKey) style.Color
}
Resolver is what sidepane needs for style lookups. satisfied by *style.Resolver via ui's styleResolver interface.
type TOC ¶
type TOC struct {
// contains filtered or unexported fields
}
TOC manages the markdown table-of-contents navigation pane.
func ParseTOC ¶
ParseTOC scans diff lines for markdown headers and builds a TOC. headers inside fenced code blocks (```) are excluded. fence tracking is CommonMark-compliant: closing fence must use the same character with at least the same length as the opening fence. returns nil when no headers are found.
func (*TOC) CurrentLineIdx ¶
CurrentLineIdx returns the diff line index of the entry at the current cursor position. returns ok=false when entries are empty or cursor is out of range.
func (*TOC) EnsureVisible ¶
EnsureVisible adjusts offset so the cursor is within the visible range of given height.
func (*TOC) Move ¶
Move navigates the cursor according to the given motion. count is variadic: page motions use count[0] for the page size, non-page motions ignore count entirely. Missing count for page motions defaults to 1 (single step), which is harmless.
func (*TOC) NumEntries ¶
NumEntries returns the number of TOC entries.
func (*TOC) Render ¶
Render produces the TOC display string with indentation by level. the highlighted entry uses FileSelected style in both modes: when TOC is focused it highlights the cursor, when diff is focused it highlights the active section.
func (*TOC) SyncCursorToActiveSection ¶
func (t *TOC) SyncCursorToActiveSection()
SyncCursorToActiveSection sets cursor to activeSection when activeSection >= 0. no-op when activeSection == -1 (no active section).
func (*TOC) UpdateActiveSection ¶
UpdateActiveSection finds the nearest entry with lineIdx <= diffCursor and sets activeSection. sets activeSection back to -1 when no entry matches, preserving the sentinel contract.