From 185a19e56f4ee7a08739703ec8a7d078de6fff20 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Fri, 17 Jul 2020 18:37:51 -0400 Subject: [PATCH] Fix cases where pager would add blank lines to bottom of document --- viewport/viewport.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/viewport/viewport.go b/viewport/viewport.go index 6b34707..4f24e4f 100644 --- a/viewport/viewport.go +++ b/viewport/viewport.go @@ -95,8 +95,8 @@ func (m *Model) ViewDown() []string { } m.YOffset = min( - m.YOffset+m.Height, // target - len(m.lines)-m.Height, // fallback + m.YOffset+m.Height, // target + len(m.lines)-1-m.Height, // fallback ) return m.visibleLines() @@ -123,8 +123,8 @@ func (m *Model) HalfViewDown() (lines []string) { } m.YOffset = min( - m.YOffset+m.Height/2, // target - len(m.lines)-m.Height, // fallback + m.YOffset+m.Height/2, // target + len(m.lines)-1-m.Height, // fallback ) if len(m.lines) > 0 { @@ -163,8 +163,8 @@ func (m *Model) LineDown(n int) (lines []string) { } m.YOffset = min( - m.YOffset+n, // target - len(m.lines)-m.Height, // fallback + m.YOffset+n, // target + len(m.lines)-1-m.Height, // fallback ) if len(m.lines) > 0 {