Fix godocs for various types and functions

This commit is contained in:
Christian Muehlhaeuser 2021-03-12 02:00:03 +01:00
parent 046b9ca129
commit a0d7cb77a1
2 changed files with 5 additions and 6 deletions

View File

@ -1,4 +1,4 @@
// package paginator provides a Bubble Tea package for calulating pagination // Package paginator provides a Bubble Tea package for calulating pagination
// and rendering pagination info. Note that this package does not render actual // and rendering pagination info. Note that this package does not render actual
// pages: it's purely for handling keystrokes related to pagination, and // pages: it's purely for handling keystrokes related to pagination, and
// rendering pagination status. // rendering pagination status.
@ -91,7 +91,7 @@ func (m *Model) NextPage() {
} }
} }
// LastPage returns whether or not we're on the last page. // OnLastPage returns whether or not we're on the last page.
func (m Model) OnLastPage() bool { func (m Model) OnLastPage() bool {
return m.Page == m.TotalPages-1 return m.Page == m.TotalPages-1
} }

View File

@ -12,8 +12,7 @@ const (
mouseWheelDelta = 3 mouseWheelDelta = 3
) )
// MODEL // Model is the Bubble Tea model for this viewport element.
type Model struct { type Model struct {
Width int Width int
Height int Height int
@ -55,7 +54,7 @@ func (m Model) PastBottom() bool {
return m.YOffset > len(m.lines)-1-m.Height return m.YOffset > len(m.lines)-1-m.Height
} }
// Scrollpercent returns the amount scrolled as a float between 0 and 1. // ScrollPercent returns the amount scrolled as a float between 0 and 1.
func (m Model) ScrollPercent() float64 { func (m Model) ScrollPercent() float64 {
if m.Height >= len(m.lines) { if m.Height >= len(m.lines) {
return 1.0 return 1.0
@ -218,7 +217,7 @@ func (m *Model) GotoTop() (lines []string) {
return lines return lines
} }
// GotoTop sets the viewport to the bottom position. // GotoBottom sets the viewport to the bottom position.
func (m *Model) GotoBottom() (lines []string) { func (m *Model) GotoBottom() (lines []string) {
m.YOffset = max(len(m.lines)-1-m.Height, 0) m.YOffset = max(len(m.lines)-1-m.Height, 0)