Documentation
¶
Overview ¶
Package sidebyside renders aligned two-pane terminal diffs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HunkLayoutKind ¶
type HunkLayoutKind uint8
HunkLayoutKind determines how a hunk is visually structured on screen.
const ( // HunkLayoutDualColumn renders a standard dual-pane 50/50 split with a central divider. HunkLayoutDualColumn HunkLayoutKind = iota // HunkLayoutSingleColumnRight renders pure insertions across the full terminal width. HunkLayoutSingleColumnRight // HunkLayoutSingleColumnLeft renders pure deletions across the full terminal width. HunkLayoutSingleColumnLeft )
func ClassifyHunk ¶ added in v0.10.0
func ClassifyHunk( h renderutil.Interval, filteredPairs []serialize.LineAlignmentPair, isPairChanged []bool, srcLines, dstLines []string, leftSpansByLine, rightSpansByLine map[int][]serialize.HighlightSpan, forceSBS bool, ) HunkLayoutKind
ClassifyHunk picks dual-column if both sides changed, or single-column for pure additions or deletions.
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 // Disable hybrid single-column layout and force 50/50 dual-column view
}
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 wraps a reusable line slicer and terminal tab width configuration.
func (*RenderScratch) SliceLineToChunks ¶
func (s *RenderScratch) SliceLineToChunks( lineText string, badgeText string, spans []serialize.HighlightSpan, targetWidth int, lineCtx renderutil.LineContext, padToTargetWidth bool, colorMode bool, badgeColor ...int, ) [][]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, lineCtx renderutil.LineContext, padToTargetWidth bool, colorMode bool, w io.Writer, badgeColor ...int, ) error
SliceLineToColumn formats a single line of text into a single targetWidth column.