feat(viewport): line count getters (#283)

This commit is contained in:
Adam Bull 2022-11-07 15:05:03 +00:00 committed by GitHub
parent 0474e129b8
commit fac7a01329
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,6 +207,16 @@ func (m *Model) LineUp(n int) (lines []string) {
return m.visibleLines() return m.visibleLines()
} }
// TotalLineCount returns the total number of lines (both hidden and visible) within the viewport.
func (m Model) TotalLineCount() int {
return len(m.lines)
}
// VisibleLineCount returns the number of the visible lines within the viewport.
func (m Model) VisibleLineCount() int {
return len(m.visibleLines())
}
// GotoTop sets the viewport to the top position. // GotoTop sets the viewport to the top position.
func (m *Model) GotoTop() (lines []string) { func (m *Model) GotoTop() (lines []string) {
if m.AtTop() { if m.AtTop() {