Skip to content

Commit

Permalink
Expose visible and total line count methods within viewport
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Bull committed Nov 4, 2022
1 parent 0474e12 commit 7f98a14
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions viewport/viewport.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@ func (m *Model) LineUp(n int) (lines []string) {
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.
func (m *Model) GotoTop() (lines []string) {
if m.AtTop() {
Expand Down

0 comments on commit 7f98a14

Please sign in to comment.