pager

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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

func (kb *KeyBinds) GetKeyBinds() []keys.KeyBind

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) ExitSearch

func (m *PagerModel) ExitSearch()

ExitSearch exits search mode.

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) StartClearDiffTimer added in v0.20.0

func (m *PagerModel) StartClearDiffTimer() tea.Cmd

StartClearDiffTimer starts a [diffTimeoutSeconds] timer to clear diff highlights.

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.

type ViewState

type ViewState int
const (
	StateReady ViewState = iota
	StateLoadingDocument
	StateShowingError
	StateShowingStatusMessage
	StateSearching
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL