viewport

package
v0.0.0-...-766dd70 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultWidth  = 80
	DefaultHeight = 25
)

DefaultWidth and DefaultHeight define the default dimensions for the viewport.

Functions

This section is empty.

Types

type Model

type Model struct {
	foam.Common
	*viewport.Model
	// contains filtered or unexported fields
}

Model wraps the Bubble Tea viewport model with additional functionality and styling options provided by the Sugarfoam framework.

func New

func New(opts ...Option) *Model

New creates a new viewport model with optional configurations.

func (*Model) Blur

func (m *Model) Blur()

Blur removes focus from the viewport.

func (*Model) CanGrow

func (m *Model) CanGrow() bool

func (*Model) Focus

func (m *Model) Focus() tea.Cmd

Focus sets the viewport to be focused.

func (*Model) Focused

func (m *Model) Focused() bool

Focused returns the focus state of the viewport.

func (*Model) GetHeight

func (m *Model) GetHeight() int

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the viewport model.

func (*Model) SetHeight

func (t *Model) SetHeight(height int)

func (*Model) SetSize

func (t *Model) SetSize(w, h int)

func (*Model) SetWidth

func (t *Model) SetWidth(width int)

func (*Model) Update

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

Update updates the viewport model based on the received message.

func (*Model) View

func (m *Model) View() string

View renders the viewport model, applying the appropriate style based on focus state.

type Option

type Option func(*Model)

Option is a type for functions that modify a viewport model.

func WithStyles

func WithStyles(styles *foam.Styles) Option

WithStyles sets the styles for the viewport using the provided styles.

Jump to

Keyboard shortcuts

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