Documentation
¶
Index ¶
- type ClearDiffTimerMsg
- type Config
- type ContentRenderedMsg
- type KeyBinds
- type KeyHandler
- type PagerModel
- func (m *PagerModel) ClearText() tea.Cmd
- func (m *PagerModel) CopyContent() tea.Cmd
- func (m *PagerModel) ExitSearch()
- func (m *PagerModel) GoToBottom()
- func (m *PagerModel) GoToTop()
- func (m *PagerModel) HalfPageDown()
- func (m *PagerModel) HalfPageUp()
- func (m *PagerModel) MoveDown()
- func (m *PagerModel) MoveUp()
- func (m *PagerModel) NextMatch() tea.Cmd
- func (m *PagerModel) PageDown()
- func (m *PagerModel) PageUp()
- func (m *PagerModel) PrevMatch() tea.Cmd
- func (m PagerModel) Render(yaml string) tea.Cmd
- func (m *PagerModel) SetHelpVisible(visible bool)
- func (m *PagerModel) SetSearchText(text string) tea.Cmd
- func (m *PagerModel) SetSize(w, h int)
- func (m *PagerModel) StartClearDiffTimer() tea.Cmd
- func (m *PagerModel) StartSearch() tea.Cmd
- func (m *PagerModel) ToggleHelp()
- func (m *PagerModel) Unload()
- func (m PagerModel) Update(msg tea.Msg) (PagerModel, tea.Cmd)
- func (m PagerModel) View() string
- func (m *PagerModel) WaitForClearDiffTimer() tea.Cmd
- type ViewState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClearDiffTimerMsg ¶ added in v0.20.0
type ClearDiffTimerMsg struct{}
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 KeyHandler ¶ added in v0.24.1
type KeyHandler struct {
// contains filtered or unexported fields
}
KeyHandler provides key handling for pager view.
func NewKeyHandler ¶ added in v0.24.1
func NewKeyHandler(kb *KeyBinds, ckb *common.KeyBinds) *KeyHandler
NewKeyHandler creates a new pager key handler.
func (*KeyHandler) HandlePagerKeys ¶ added in v0.24.1
func (h *KeyHandler) HandlePagerKeys(m PagerModel, msg tea.KeyMsg) (PagerModel, tea.Cmd)
HandlePagerKeys handles key events for pager view.
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 yamls.Document
ViewState ViewState
ShowHelp bool
// contains filtered or unexported fields
}
func NewModel ¶
func NewModel(c Config) PagerModel
func (*PagerModel) ClearText ¶ added in v0.24.1
func (m *PagerModel) ClearText() tea.Cmd
ClearText clears all text from the search input.
func (*PagerModel) CopyContent ¶ added in v0.24.1
func (m *PagerModel) CopyContent() tea.Cmd
CopyContent copies the current document content to clipboard.
func (*PagerModel) GoToBottom ¶ added in v0.24.1
func (m *PagerModel) GoToBottom()
GoToBottom moves to the bottom of the document.
func (*PagerModel) GoToTop ¶ added in v0.24.1
func (m *PagerModel) GoToTop()
GoToTop moves to the top of the document.
func (*PagerModel) HalfPageDown ¶ added in v0.24.1
func (m *PagerModel) HalfPageDown()
HalfPageDown moves the viewport down by half a page.
func (*PagerModel) HalfPageUp ¶ added in v0.24.1
func (m *PagerModel) HalfPageUp()
HalfPageUp moves the viewport up by half a page.
func (*PagerModel) MoveDown ¶ added in v0.24.1
func (m *PagerModel) MoveDown()
MoveDown moves the viewport down.
func (*PagerModel) MoveUp ¶ added in v0.24.1
func (m *PagerModel) MoveUp()
MoveUp moves the viewport up.
func (*PagerModel) NextMatch ¶ added in v0.24.1
func (m *PagerModel) NextMatch() tea.Cmd
NextMatch goes to the next search match.
func (*PagerModel) PageDown ¶ added in v0.24.1
func (m *PagerModel) PageDown()
PageDown moves the viewport down by one page.
func (*PagerModel) PageUp ¶ added in v0.24.1
func (m *PagerModel) PageUp()
PageUp moves the viewport up by one page.
func (*PagerModel) PrevMatch ¶ added in v0.24.1
func (m *PagerModel) PrevMatch() tea.Cmd
PrevMatch goes to the previous search match.
func (PagerModel) Render ¶
func (m PagerModel) Render(yaml string) tea.Cmd
This is where the magic happens.
func (*PagerModel) SetHelpVisible ¶ added in v0.24.1
func (m *PagerModel) SetHelpVisible(visible bool)
SetHelpVisible sets help visibility.
func (*PagerModel) SetSearchText ¶ added in v0.24.1
func (m *PagerModel) SetSearchText(text string) tea.Cmd
SetSearchText sets the search text and applies the search.
func (*PagerModel) SetSize ¶
func (m *PagerModel) SetSize(w, h int)
func (*PagerModel) StartClearDiffTimer ¶ added in v0.20.0
func (m *PagerModel) StartClearDiffTimer() tea.Cmd
StartClearDiffTimer starts a [diffTimeoutSeconds] timer to clear diff highlights.
func (*PagerModel) StartSearch ¶ added in v0.24.1
func (m *PagerModel) StartSearch() tea.Cmd
StartSearch initializes search mode.
func (*PagerModel) ToggleHelp ¶ added in v0.24.1
func (m *PagerModel) ToggleHelp()
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
func (*PagerModel) WaitForClearDiffTimer ¶ added in v0.20.0
func (m *PagerModel) WaitForClearDiffTimer() tea.Cmd
WaitForClearDiffTimer returns a command that waits for the clear diff timer to expire.