From fac7a01329ea65161171597c8c2ed10de417091d Mon Sep 17 00:00:00 2001 From: Adam Bull Date: Mon, 7 Nov 2022 15:05:03 +0000 Subject: [PATCH] feat(viewport): line count getters (#283) --- viewport/viewport.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/viewport/viewport.go b/viewport/viewport.go index 2be4f7a..f67f57d 100644 --- a/viewport/viewport.go +++ b/viewport/viewport.go @@ -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() {