Documentation
¶
Overview ¶
Package sidebyside renders aligned two-pane terminal diffs.
Index ¶
- func Render(srcFile, dstFile string, srcBytes, dstBytes []byte, env *serialize.Envelope, ...) error
- func RenderFileBanner(path string, insertions, deletions, updates int, colorMode bool, w io.Writer) error
- type HunkLayoutKind
- type RenderOptions
- type RenderScratch
- func (s *RenderScratch) ResolveColHighlights(lineText string, spans []serialize.HighlightSpan, pane string) ([]int, []int)
- func (s *RenderScratch) SliceLineToChunks(lineText string, badgeText string, spans []serialize.HighlightSpan, ...) [][]byte
- func (s *RenderScratch) SliceLineToColumn(lineText string, badgeText string, spans []serialize.HighlightSpan, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HunkLayoutKind ¶
type HunkLayoutKind uint8
HunkLayoutKind determines how a hunk or hunk segment is visually structured on screen.
const ( // HunkLayoutSideBySide renders a standard dual-pane 50/50 split with a central divider. HunkLayoutSideBySide HunkLayoutKind = iota // HunkLayoutFullWidthInline renders pure single-sided inserts/deletes using the full terminal width. HunkLayoutFullWidthInline )
type RenderOptions ¶
type RenderOptions struct {
TerminalWidth int // Detected or overridden terminal width (default 0 = auto)
ContextLines int // Context lines around hunks (default 3, -1 for full file)
LineNumbers bool // Show line number gutters
Color bool // Enable TrueColor ANSI escapes
DisableAnnotations bool // Suppress AST move annotations and badges
TabWidth int // Spaces per tab stop (default 4)
ForceSideBySide bool // Prevent falling back to inline diff on narrow screens
AdaptiveThreshold int // Min consecutive single-sided lines to trigger full-width inline hunk (default 6, 0 to disable)
}
RenderOptions defines configuration for side-by-side rendering.
func DefaultOptions ¶
func DefaultOptions() RenderOptions
DefaultOptions returns standard settings for interactive terminals.
type RenderScratch ¶
type RenderScratch struct {
TabWidth int
// contains filtered or unexported fields
}
RenderScratch provides reusable highlight index arrays and tab width settings.
func (*RenderScratch) ResolveColHighlights ¶
func (s *RenderScratch) ResolveColHighlights(lineText string, spans []serialize.HighlightSpan, pane string) ([]int, []int)
ResolveColHighlights maps each byte offset in lineText to an action kind and span ID.
func (*RenderScratch) SliceLineToChunks ¶
func (s *RenderScratch) SliceLineToChunks( lineText string, badgeText string, spans []serialize.HighlightSpan, targetWidth int, pane string, isDeleteLine bool, colorMode bool, ) [][]byte
SliceLineToChunks formats a single line of text with syntax/action spans into multiple targetWidth display rows (wrapping).
func (*RenderScratch) SliceLineToColumn ¶
func (s *RenderScratch) SliceLineToColumn( lineText string, badgeText string, spans []serialize.HighlightSpan, targetWidth int, pane string, isDeleteLine bool, colorMode bool, w io.Writer, ) error
SliceLineToColumn formats a single line of text into a single targetWidth column.