Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChromaRenderer ¶
type ChromaRenderer struct {
// contains filtered or unexported fields
}
ChromaRenderer handles rendering content with chroma styling.
func NewChromaRenderer ¶
func NewChromaRenderer(theme *themes.Theme, lineNumbersDisabled bool) *ChromaRenderer
NewChromaRenderer creates a new ChromaRenderer.
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) 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.
type Config ¶
type Config struct {
CommonModel *common.CommonModel
KeyBinds *KeyBinds
ChromaRendering bool
ShowLineNumbers bool
}
type ContentRenderedMsg ¶
type ContentRenderedMsg string
type KeyBinds ¶
type KeyBinds struct {
Copy *keys.KeyBind `json:"copy,omitempty"`
// Navigation.
Home *keys.KeyBind `json:"home,omitempty"`
End *keys.KeyBind `json:"end,omitempty"`
PageUp *keys.KeyBind `json:"pageUp,omitempty"`
PageDown *keys.KeyBind `json:"pageDown,omitempty"`
HalfPageUp *keys.KeyBind `json:"halfPageUp,omitempty"`
HalfPageDown *keys.KeyBind `json:"halfPageDown,omitempty"`
// Search.
Search *keys.KeyBind `json:"search,omitempty"`
NextMatch *keys.KeyBind `json:"nextMatch,omitempty"`
PrevMatch *keys.KeyBind `json:"prevMatch,omitempty"`
}
func (*KeyBinds) EnsureDefaults ¶
func (kb *KeyBinds) EnsureDefaults()
func (*KeyBinds) GetKeyBinds ¶
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).
Length int // Length of the match.
}
MatchPosition represents a search match position within the content.
type PagerModel ¶
type PagerModel struct {
// Current document being rendered, sans-chroma rendering. We cache
// it here so we can re-render it on resize.
CurrentDocument yamldoc.YAMLDocument
ViewState ViewState
ShowHelp bool
// contains filtered or unexported fields
}
func NewModel ¶
func NewModel(c Config) PagerModel
func (PagerModel) Render ¶
func (m PagerModel) Render(yaml string) tea.Cmd
This is where the magic happens.
func (*PagerModel) SetSize ¶
func (m *PagerModel) SetSize(w, h int)
func (*PagerModel) Unload ¶
func (m *PagerModel) Unload()
func (PagerModel) Update ¶
func (m PagerModel) Update(msg tea.Msg) (PagerModel, tea.Cmd)
func (PagerModel) View ¶
func (m PagerModel) View() string
Click to show internal directories.
Click to hide internal directories.