Documentation
¶
Index ¶
- func HalfViewDown(m Model, lines []string) tea.Cmd
- func HalfViewUp(m Model, lines []string) tea.Cmd
- func LineDown(m Model, lines []string) tea.Cmd
- func LineUp(m Model, lines []string) tea.Cmd
- func Sync(m Model) tea.Cmd
- func View(m Model) string
- func ViewDown(m Model, lines []string) tea.Cmd
- func ViewUp(m Model, lines []string) tea.Cmd
- type Model
- func (m Model) AtBottom() bool
- func (m Model) AtTop() bool
- func (m *Model) HalfViewDown() (lines []string)
- func (m *Model) HalfViewUp() (lines []string)
- func (m *Model) LineDown(n int) (lines []string)
- func (m *Model) LineUp(n int) (lines []string)
- func (m Model) ScrollPercent() float64
- func (m *Model) SetContent(s string)
- func (m Model) SetSize(yPos, width, height int)
- func (m *Model) ViewDown() []string
- func (m *Model) ViewUp() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HalfViewDown ¶ added in v0.3.0
HalfViewDown is a high performance command the moves the viewport down by half of the height of the viewport. Use Model.HalfViewDown to get the lines that should be rendered.
func HalfViewUp ¶ added in v0.3.0
HalfViewUp is a high performance command the moves the viewport up by half of the height of the viewport. Use Model.HalfViewUp to get the lines that should be rendered.
func LineDown ¶ added in v0.3.0
LineDown is a high performance command the moves the viewport down by a given number of lines. Use Model.LineDown to get the lines that should be rendered.
func LineUp ¶ added in v0.3.0
LineDown is a high performance command the moves the viewport up by a given number of lines. Use Model.LineDown to get the lines that should be rendered.
func Sync ¶ added in v0.3.0
Sync tells the renderer where the viewport will be located and requests a render of the current state of the viewport. It should be called for the first render and after a window resize.
For high performance rendering only.
Types ¶
type Model ¶
type Model struct { Width int Height 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. YPosition int // HighPerformanceRendering bypasses the normal Bubble Tea renderer to // provide higher performance rendering. Most of the time the normal Bubble // Tea rendering methods will suffice, but if you're passing content with // a lot of ANSI escape codes you may see improved rendering in certain // terminals with this enabled. // // This should only be used in program occupying the entire terminal, // which is usually via the alternate screen buffer. HighPerformanceRendering bool // contains filtered or unexported fields }
func Update ¶
Update runs the update loop with default keybindings similar to popular pagers. To define your own keybindings use the methods on Model (i.e. Model.LineDown()) and define your own update function.
func (Model) AtBottom ¶ added in v0.3.0
AtBottom returns whether or not the viewport is at the very botom position.
func (Model) AtTop ¶ added in v0.3.0
AtTop returns whether or not the viewport is in the very top position.
func (*Model) HalfViewDown ¶
HalfViewDown moves the view down by half the height of the viewport.
func (*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) ScrollPercent ¶
Scrollpercent returns the amount scrolled as a float between 0 and 1.
func (*Model) SetContent ¶
SetContent set the pager's text content. For high performance rendering the Sync command should also be called.