viewport

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKeyMap

func GetKeyMap() viewportKeyMap

Types

type Model

type Model struct {

	// SpecialContentIdx can be used to highlight a specific item in the content, e.g. the
	// currently selected item in a set of filtered results
	SpecialContentIdx int

	HeaderStyle          lipgloss.Style
	SelectedContentStyle lipgloss.Style
	HighlightStyle       lipgloss.Style
	// SpecialHighlightStyle for example styles the currently selected filtered item differently
	SpecialHighlightStyle lipgloss.Style
	ContentStyle          lipgloss.Style
	FooterStyle           lipgloss.Style
	// ConditionalStyle styles lines containing key with corresponding style in value
	ConditionalStyle map[string]lipgloss.Style
	// contains filtered or unexported fields
}

func New

func New(width, height int, compactTableContent bool) (m Model)

func (*Model) HideToast

func (m *Model) HideToast()

func (Model) Saving

func (m Model) Saving() bool

func (*Model) ScrollToBottom added in v0.2.0

func (m *Model) ScrollToBottom()

func (Model) SelectedContentIdx

func (m Model) SelectedContentIdx() int

func (Model) SelectionEnabled added in v0.3.1

func (m Model) SelectionEnabled() bool

func (*Model) SetContent

func (m *Model) SetContent(content []string)

func (*Model) SetHeader

func (m *Model) SetHeader(header []string)

func (*Model) SetSelectedContentIdx

func (m *Model) SetSelectedContentIdx(n int)

SetSelectedContentIdx sets the selectedContentIdx with bounds. Adjusts yOffset as necessary.

func (*Model) SetSelectionEnabled

func (m *Model) SetSelectionEnabled(selectionEnabled bool)

func (*Model) SetShowPrompt added in v0.2.0

func (m *Model) SetShowPrompt(v bool)

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize sets the viewport's width and height, including header.

func (*Model) SetStringToHighlight

func (m *Model) SetStringToHighlight(h string)

func (*Model) SetToast added in v1.1.0

func (m *Model) SetToast(toast toast.Model, style lipgloss.Style)

func (*Model) SetWrapText

func (m *Model) SetWrapText(wrapText bool)

func (*Model) SetXOffset

func (m *Model) SetXOffset(n int)

func (*Model) ToggleWrapText

func (m *Model) ToggleWrapText()

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

func (Model) View

func (m Model) View() string

Jump to

Keyboard shortcuts

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