viewport

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 2 Imported by: 717

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func View

func View(m Model) string

View renders the viewport into a string.

Types

type Model

type Model struct {
	Err    error
	Width  int
	Height int
	Y      int
	// contains filtered or unexported fields
}

func NewModel

func NewModel(width, height int) Model

NewModel creates a new pager model. Pass the dimensions of the pager.

func Update

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

Update runs the update loop with default keybindings. To define your own keybindings use the methods on Model.

func (*Model) HalfViewDown

func (m *Model) HalfViewDown()

HalfViewDown moves the view down by half the height of the viewport.

func (*Model) HalfViewUp

func (m *Model) HalfViewUp()

HalfViewUp moves the view up by half the height of the viewport.

func (*Model) LineDown

func (m *Model) LineDown(n int)

LineDown moves the view up by the given number of lines.

func (*Model) LineUp

func (m *Model) LineUp(n int)

LineDown moves the view down by the given number of lines.

func (Model) ScrollPercent

func (m Model) ScrollPercent() float64

Scrollpercent returns the amount scrolled as a float between 0 and 1.

func (*Model) SetContent

func (m *Model) SetContent(s string)

SetContent set the pager's text content.

func (*Model) ViewDown

func (m *Model) ViewDown()

ViewDown moves the view down by the number of lines in the viewport. Basically, "page down".

func (*Model) ViewUp

func (m *Model) ViewUp()

ViewUp moves the view up by one height of the viewport. Basically, "page up".

Jump to

Keyboard shortcuts

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