streamview

package
v0.0.0-...-69e65b7 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	Name string // for debugging

	Width  int
	Height int

	// Whether or not to respond to the mouse. The mouse must be enabled in
	// Bubble Tea for this to work. For details, see the Bubble Tea docs.
	MouseWheelEnabled bool

	// The number of lines the mouse wheel will scroll. By default, this is 3.
	MouseWheelDelta int

	// CurrentLine is the current line number at the top of the viewport, 0-based.
	// It may be larger than the number of lines.
	CurrentLine int

	// Style applies a lipgloss style to the viewport. Realistically, it's most
	// useful for setting borders, margins and padding.
	Style      lipgloss.Style
	FocusStyle lipgloss.Style
	// contains filtered or unexported fields
}

Model is the Bubble Tea model for this viewport element.

func New

func New(shared *stream.Shared) (m Model)

New returns a new model with default key mappings. The zero value is not valid.

func (Model) AtBottom

func (m Model) AtBottom() bool

AtBottom returns whether or not the viewport is at or past the very bottom position.

func (Model) AtTop

func (m Model) AtTop() bool

AtTop returns whether or not the viewport is at the very top position.

func (*Model) Blur

func (m *Model) Blur()

func (*Model) Focus

func (m *Model) Focus()

func (*Model) GotoBottom

func (m *Model) GotoBottom()

GotoBottom sets the viewport to the bottom position.

func (*Model) GotoTop

func (m *Model) GotoTop()

GotoTop sets the viewport to the top position.

func (*Model) HalfViewDown

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

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

func (m Model) Init() tea.Cmd

func (*Model) LineDown

func (m *Model) LineDown(n int) (cmd tea.Cmd)

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

func (*Model) LineUp

func (m *Model) LineUp(n int)

LineUp moves the view down by the given number of lines. Returns the new lines to show.

func (Model) PastBottom

func (m Model) PastBottom() bool

PastBottom returns whether or not the viewport is scrolled beyond the last line. This can happen when adjusting the viewport height.

func (*Model) SetCurrentLine

func (m *Model) SetCurrentLine(n int)

SetCurrentLine sets the current line.

func (Model) TotalLineCount

func (m Model) TotalLineCount() int

TotalLineCount returns the total number of lines (both hidden and visible) within the viewport.

func (Model) Update

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

Update handles standard message-based viewport updates.

func (*Model) View

func (m *Model) View() string

View renders the viewport into a string.

func (*Model) ViewDown

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

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".

func (Model) VisibleLineCount

func (m Model) VisibleLineCount() int

Jump to

Keyboard shortcuts

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