Documentation
¶
Index ¶
- func Normalize(in string) (string, error)
- type ChromaRenderer
- func (gr *ChromaRenderer) ClearDiffs()
- func (gr *ChromaRenderer) FindMatchesInContent(content string)
- func (gr *ChromaRenderer) GetCurrentSelectedMatch() int
- func (gr *ChromaRenderer) GetMatches() []MatchPosition
- func (gr *ChromaRenderer) RenderContent(yaml string, width int) (string, error)
- func (gr *ChromaRenderer) SetCurrentSelectedMatch(index int)
- func (gr *ChromaRenderer) SetFormatter(name string)
- func (gr *ChromaRenderer) SetSearchTerm(term string)
- func (gr *ChromaRenderer) Unload()
- type DiffHighlighter
- type DiffPosition
- type DiffType
- type Differ
- func (dh *Differ) ClearDiffs()
- func (dh *Differ) FindAndCacheDiffs(currentContent string) []DiffPosition
- func (dh *Differ) FindDiffs(currentContent string) []DiffPosition
- func (dh *Differ) GetDiffs() []DiffPosition
- func (dh *Differ) SetInitialContent(content string)
- func (dh *Differ) SetOriginalContent(content string)
- func (dh *Differ) Unload()
- type Document
- type MatchPosition
- type SearchHighlighter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChromaRenderer ¶
type ChromaRenderer struct {
// contains filtered or unexported fields
}
ChromaRenderer handles rendering content with chroma styling.
func NewChromaRenderer ¶
func NewChromaRenderer(t *theme.Theme, lineNumbersDisabled bool) *ChromaRenderer
NewChromaRenderer creates a new ChromaRenderer.
func (*ChromaRenderer) ClearDiffs ¶ added in v0.20.0
func (gr *ChromaRenderer) ClearDiffs()
func (*ChromaRenderer) FindMatchesInContent ¶
func (gr *ChromaRenderer) FindMatchesInContent(content string)
FindMatchesInContent finds matches in the given content and stores them. This is useful when you need to find matches immediately rather than waiting for the next render.
func (*ChromaRenderer) GetCurrentSelectedMatch ¶
func (gr *ChromaRenderer) GetCurrentSelectedMatch() int
GetCurrentSelectedMatch returns the index of the currently selected match.
func (*ChromaRenderer) GetMatches ¶
func (gr *ChromaRenderer) GetMatches() []MatchPosition
GetMatches returns the current search matches.
func (*ChromaRenderer) RenderContent ¶
func (gr *ChromaRenderer) RenderContent(yaml string, width int) (string, error)
RenderContent renders YAML content with chroma styling.
func (*ChromaRenderer) SetCurrentSelectedMatch ¶
func (gr *ChromaRenderer) SetCurrentSelectedMatch(index int)
SetCurrentSelectedMatch sets the index of the currently selected match.
func (*ChromaRenderer) SetFormatter ¶
func (gr *ChromaRenderer) SetFormatter(name string)
SetFormatter sets the chroma formatter explicitly. This is primarily useful for testing.
func (*ChromaRenderer) SetSearchTerm ¶
func (gr *ChromaRenderer) SetSearchTerm(term string)
SetSearchTerm sets the search term and clears existing matches.
func (*ChromaRenderer) Unload ¶ added in v0.20.0
func (gr *ChromaRenderer) Unload()
Unload clears the current state of the renderer.
type DiffHighlighter ¶ added in v0.20.0
type DiffHighlighter struct {
// contains filtered or unexported fields
}
DiffHighlighter handles diff-specific highlighting via *ansis.StyleEditor.
func NewDiffHighlighter ¶ added in v0.20.0
func NewDiffHighlighter(insertedStyle, deletedStyle, editedStyle lipgloss.Style) *DiffHighlighter
NewDiffHighlighter creates a new DiffHighlighter.
func (*DiffHighlighter) ApplyDiffHighlights ¶ added in v0.20.0
func (dh *DiffHighlighter) ApplyDiffHighlights(text string, diffs []DiffPosition) string
ApplyDiffHighlights applies diff highlighting to content that already has chroma styling. It converts DiffPosition slices to ansis.StyleRange slices and delegates to the *ansis.StyleEditor.
type DiffPosition ¶ added in v0.20.0
type DiffPosition struct {
Line int // 0-based line number.
Start int // 0-based character position within the line.
End int // 0-based character position within the line (exclusive).
Type DiffType // Type of change (added, removed, or changed).
}
DiffPosition represents a diff change position within the content.
type Differ ¶ added in v0.20.0
type Differ struct {
// contains filtered or unexported fields
}
func (*Differ) ClearDiffs ¶ added in v0.20.0
func (dh *Differ) ClearDiffs()
ClearDiffs clears the current diff positions.
func (*Differ) FindAndCacheDiffs ¶ added in v0.20.0
func (dh *Differ) FindAndCacheDiffs(currentContent string) []DiffPosition
FindAndCacheDiffs calls Differ.FindDiffs, stores the diffs internally and re-returns them if the content hasn't changed.
func (*Differ) FindDiffs ¶ added in v0.20.0
func (dh *Differ) FindDiffs(currentContent string) []DiffPosition
FindAndCacheDiffs finds differences between the current content and the original content using go-udiff.
func (*Differ) GetDiffs ¶ added in v0.20.0
func (dh *Differ) GetDiffs() []DiffPosition
GetDiffs returns the current diff positions.
func (*Differ) SetInitialContent ¶ added in v0.20.0
SetInitialContent sets the initial content for diff comparison.
func (*Differ) SetOriginalContent ¶ added in v0.20.0
SetOriginalContent sets the original content for diff comparison.
type Document ¶
type Document struct {
Object *kube.Object
// Value we filter against. This exists so that we can maintain positions
// of filtered items if titles are edited while a filter is active. This
// field is ephemeral, and should only be referenced during filtering.
FilterValue string
Body string
Title string
Desc string
}
func (*Document) BuildFilterValue ¶
func (m *Document) BuildFilterValue()
Generate the value we're doing to filter against.
type MatchPosition ¶
type MatchPosition struct {
Line int // 0-based line number.
Start int // 0-based character position within the line.
End int // 0-based character position within the line (exclusive).
}
MatchPosition represents a search match position within the content.
type SearchHighlighter ¶
type SearchHighlighter struct {
// contains filtered or unexported fields
}
SearchHighlighter handles search-specific highlighting via *ansis.StyleEditor.
func NewSearchHighlighter ¶
func NewSearchHighlighter(highlightStyle, selectedHighlightStyle lipgloss.Style) *SearchHighlighter
NewSearchHighlighter creates a new SearchHighlighter.
func (*SearchHighlighter) ApplyHighlights ¶
func (sh *SearchHighlighter) ApplyHighlights(text string, matches []MatchPosition, selectedMatch int) string
ApplyHighlights applies search highlighting to content that already has chroma styling. It converts MatchPosition slices to [StyleRange] slices and delegates to the *ansis.StyleEditor.