Documentation ¶
Index ¶
- func ViewDown(m Viewport, lines []string) tea.Cmd
- func ViewUp(m Viewport, lines []string) tea.Cmd
- type Viewport
- func (m Viewport) AtBottom() bool
- func (m Viewport) AtTop() bool
- func (m *Viewport) GotoBottom() (lines []string)
- func (m *Viewport) GotoTop() (lines []string)
- func (m *Viewport) HalfViewDown() (lines []string)
- func (m *Viewport) HalfViewUp() (lines []string)
- func (m Viewport) Init() tea.Cmd
- func (m *Viewport) LineDown(n int) (lines []string)
- func (m *Viewport) LineUp(n int) (lines []string)
- func (m Viewport) PastBottom() bool
- func (m Viewport) ScrollPercent() float64
- func (m *Viewport) SetContent(s string)
- func (m *Viewport) SetYOffset(n int)
- func (m Viewport) Update(msg tea.Msg) (Viewport, tea.Cmd)
- func (m Viewport) View() string
- func (m *Viewport) ViewDown() []string
- func (m *Viewport) ViewUp() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Viewport ¶
type Viewport struct { Width int Height int KeyMap keymap.KeyMap // 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 // YOffset is the vertical scroll position. YOffset int // YPosition is the position of the viewport in relation to the terminal // window. It's used in high performance rendering only. YPosition int // Style applies a lipgloss style to the viewport. Realistically, it's most // useful for setting borders, margins and padding. Style lipgloss.Style // contains filtered or unexported fields }
Viewport is the Bubble Tea model for this viewport element.
func NewViewport ¶
New returns a new model with the given width and height as well as default keymappings.
func (Viewport) AtBottom ¶
AtBottom returns whether or not the viewport is at or past the very bottom position.
func (*Viewport) GotoBottom ¶
GotoBottom sets the viewport to the bottom position.
func (*Viewport) HalfViewDown ¶
HalfViewDown moves the view down by half the height of the viewport.
func (*Viewport) HalfViewUp ¶
HalfViewUp moves the view up by half the height of the viewport.
func (*Viewport) LineUp ¶
LineUp moves the view down by the given number of lines. Returns the new lines to show.
func (Viewport) PastBottom ¶
PastBottom returns whether or not the viewport is scrolled beyond the last line. This can happen when adjusting the viewport height.
func (Viewport) ScrollPercent ¶
ScrollPercent returns the amount scrolled as a float between 0 and 1.
func (*Viewport) SetContent ¶
SetContent set the pager's text content. For high performance rendering the Sync command should also be called.