Documentation
¶
Index ¶
- Constants
- type DiffHunk
- type DiffType
- type LineNumberProvider
- func (p *LineNumberProvider) HighlightedLines() []gutter.LineHighlight
- func (p *LineNumberProvider) ID() string
- func (p *LineNumberProvider) Layout(gtx layout.Context, ctx gutter.GutterContext) layout.Dimensions
- func (p *LineNumberProvider) Priority() int
- func (p *LineNumberProvider) Width(gtx layout.Context, shaper *text.Shaper, params text.Parameters, lineCount int) unit.Dp
- type VCSDiffProvider
- func (p *VCSDiffProvider) ClearDiff()
- func (p *VCSDiffProvider) GetAllHunks() []*DiffHunk
- func (p *VCSDiffProvider) GetHunk(line int) *DiffHunk
- func (p *VCSDiffProvider) HandleClick(line int, source pointer.Source, numClicks int, modifiers key.Modifiers) bool
- func (p *VCSDiffProvider) HandleHover(line int) *gutter.HoverInfo
- func (p *VCSDiffProvider) HighlightedLines() []gutter.LineHighlight
- func (p *VCSDiffProvider) ID() string
- func (p *VCSDiffProvider) Layout(gtx layout.Context, ctx gutter.GutterContext) layout.Dimensions
- func (p *VCSDiffProvider) Priority() int
- func (p *VCSDiffProvider) SetColors(added, modified, deleted gvcolor.Color)
- func (p *VCSDiffProvider) SetHighlightLines(enabled bool, alpha uint8)
- func (p *VCSDiffProvider) SetIndicatorWidth(width unit.Dp)
- func (p *VCSDiffProvider) UpdateDiff(hunks []*DiffHunk)
- func (p *VCSDiffProvider) Width(gtx layout.Context, shaper *text.Shaper, params text.Parameters, lineCount int) unit.Dp
Constants ¶
const (
// DiffProviderID is the unique identifier for the diff provider.
DiffProviderID = "vcs-diff"
)
const (
// LineNumberProviderID is the unique identifier for the line number provider.
LineNumberProviderID = "linenumber"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiffHunk ¶
type DiffHunk struct {
// The diff is staged or not
Staged bool
// Type is the type of change (added, modified, deleted).
Type DiffType
// StartLine is the 0-based line index where this hunk starts in the current document.
StartLine int
// EndLine is the 0-based line index where this hunk ends (inclusive).
// For deleted hunks, StartLine == EndLine and represents where the deletion occurred.
EndLine int
// OldLines contains the original content (for modified and deleted hunks).
OldLines []string
// NewLines contains the new content (for added and modified hunks).
NewLines []string
}
DiffHunk represents a single change in the diff.
type LineNumberProvider ¶
type LineNumberProvider struct {
// contains filtered or unexported fields
}
LineNumberProvider renders line numbers in the gutter.
func NewLineNumberProvider ¶
func NewLineNumberProvider() *LineNumberProvider
NewLineNumberProvider creates a new line number provider with default settings.
func NewLineNumberProviderWithMinDigits ¶
func NewLineNumberProviderWithMinDigits(minDigits int) *LineNumberProvider
NewLineNumberProviderWithMinDigits creates a new line number provider with a custom minimum digit count.
func (*LineNumberProvider) HighlightedLines ¶
func (p *LineNumberProvider) HighlightedLines() []gutter.LineHighlight
HighlightedLines returns the current line to be highlighted. This implements the gutter.LineHighlighter interface.
func (*LineNumberProvider) ID ¶
func (p *LineNumberProvider) ID() string
ID returns the unique identifier for this provider.
func (*LineNumberProvider) Layout ¶
func (p *LineNumberProvider) Layout(gtx layout.Context, ctx gutter.GutterContext) layout.Dimensions
Layout renders the line numbers for visible paragraphs.
func (*LineNumberProvider) Priority ¶
func (p *LineNumberProvider) Priority() int
Priority returns the rendering priority. Line numbers have a high priority (100) meaning they are rendered closest to the text (rightmost in the gutter).
type VCSDiffProvider ¶
type VCSDiffProvider struct {
// contains filtered or unexported fields
}
VCSDiffProvider renders vcs (like git) diff indicators in the gutter. It shows colored bars for added/modified lines and triangles for deleted lines.
func NewVCSDiffProvider ¶
func NewVCSDiffProvider() *VCSDiffProvider
NewGitDiffProvider creates a new git diff provider with default colors.
func (*VCSDiffProvider) ClearDiff ¶
func (p *VCSDiffProvider) ClearDiff()
ClearDiff removes all diff data.
func (*VCSDiffProvider) GetAllHunks ¶
func (p *VCSDiffProvider) GetAllHunks() []*DiffHunk
GetAllHunks returns all diff hunks.
func (*VCSDiffProvider) GetHunk ¶
func (p *VCSDiffProvider) GetHunk(line int) *DiffHunk
GetHunk returns the diff hunk for the given line, or nil if none exists.
func (*VCSDiffProvider) HandleClick ¶
func (p *VCSDiffProvider) HandleClick(line int, source pointer.Source, numClicks int, modifiers key.Modifiers) bool
HandleClick handles click events on the gutter. Implements InteractiveGutter interface.
func (*VCSDiffProvider) HandleHover ¶
func (p *VCSDiffProvider) HandleHover(line int) *gutter.HoverInfo
HandleHover handles hover events on the gutter. Implements InteractiveGutter interface.
func (*VCSDiffProvider) HighlightedLines ¶
func (p *VCSDiffProvider) HighlightedLines() []gutter.LineHighlight
HighlightedLines returns line highlights for changed lines. Implements LineHighlighter interface.
func (*VCSDiffProvider) ID ¶
func (p *VCSDiffProvider) ID() string
ID returns the unique identifier for this provider.
func (*VCSDiffProvider) Layout ¶
func (p *VCSDiffProvider) Layout(gtx layout.Context, ctx gutter.GutterContext) layout.Dimensions
Layout renders the git diff indicators for visible paragraphs.
func (*VCSDiffProvider) Priority ¶
func (p *VCSDiffProvider) Priority() int
Priority returns the rendering priority. Git diff indicators are rendered leftmost (highest priority value).
func (*VCSDiffProvider) SetColors ¶
func (p *VCSDiffProvider) SetColors(added, modified, deleted gvcolor.Color)
SetColors sets custom colors for the diff indicators.
func (*VCSDiffProvider) SetHighlightLines ¶
func (p *VCSDiffProvider) SetHighlightLines(enabled bool, alpha uint8)
SetHighlightLines enables or disables full-width line highlighting.
func (*VCSDiffProvider) SetIndicatorWidth ¶
func (p *VCSDiffProvider) SetIndicatorWidth(width unit.Dp)
SetIndicatorWidth sets the width of the indicator bar.
func (*VCSDiffProvider) UpdateDiff ¶
func (p *VCSDiffProvider) UpdateDiff(hunks []*DiffHunk)
UpdateDiff updates the diff state with new hunks. This clears any existing diff data.