Fix cases where pager would add blank lines to bottom of document

This commit is contained in:
Christian Rocha 2020-07-17 18:37:51 -04:00
parent dbb1d93970
commit 185a19e56f
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

@ -96,7 +96,7 @@ func (m *Model) ViewDown() []string {
m.YOffset = min( m.YOffset = min(
m.YOffset+m.Height, // target m.YOffset+m.Height, // target
len(m.lines)-m.Height, // fallback len(m.lines)-1-m.Height, // fallback
) )
return m.visibleLines() return m.visibleLines()
@ -124,7 +124,7 @@ func (m *Model) HalfViewDown() (lines []string) {
m.YOffset = min( m.YOffset = min(
m.YOffset+m.Height/2, // target m.YOffset+m.Height/2, // target
len(m.lines)-m.Height, // fallback len(m.lines)-1-m.Height, // fallback
) )
if len(m.lines) > 0 { if len(m.lines) > 0 {
@ -164,7 +164,7 @@ func (m *Model) LineDown(n int) (lines []string) {
m.YOffset = min( m.YOffset = min(
m.YOffset+n, // target m.YOffset+n, // target
len(m.lines)-m.Height, // fallback len(m.lines)-1-m.Height, // fallback
) )
if len(m.lines) > 0 { if len(m.lines) > 0 {