Documentation
¶
Index ¶
- type Model
- func (m Model) AtBottom() bool
- func (m Model) AtTop() bool
- func (m *Model) Blur()
- func (m *Model) Focus()
- func (m *Model) GotoBottom()
- func (m *Model) GotoTop()
- func (m *Model) HalfViewDown() tea.Cmd
- func (m *Model) HalfViewUp()
- func (m Model) Init() tea.Cmd
- func (m *Model) LineDown(n int) (cmd tea.Cmd)
- func (m *Model) LineUp(n int)
- func (m Model) PastBottom() bool
- func (m *Model) SetCurrentLine(n int)
- func (m Model) TotalLineCount() int
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m *Model) View() string
- func (m *Model) ViewDown() tea.Cmd
- func (m *Model) ViewUp()
- func (m Model) VisibleLineCount() int
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 (Model) AtBottom ¶
AtBottom returns whether or not the viewport is at or past the very bottom position.
func (*Model) GotoBottom ¶
func (m *Model) GotoBottom()
GotoBottom sets the viewport to the bottom position.
func (*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) LineUp ¶
LineUp moves the view down by the given number of lines. Returns the new lines to show.
func (Model) PastBottom ¶
PastBottom returns whether or not the viewport is scrolled beyond the last line. This can happen when adjusting the viewport height.
func (*Model) SetCurrentLine ¶
SetCurrentLine sets the current line.
func (Model) TotalLineCount ¶
TotalLineCount returns the total number of lines (both hidden and visible) within the viewport.
func (*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".