From 3960657824ee43d4bd5d7842d3d4f9c96d0422cd Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 14 May 2020 15:04:39 -0400 Subject: [PATCH] Pager: fill empty space with newlines --- pager/pager.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pager/pager.go b/pager/pager.go index b09f9a2..ded1431 100644 --- a/pager/pager.go +++ b/pager/pager.go @@ -127,7 +127,15 @@ func View(model boba.Model) string { top := max(0, m.Y) bottom := min(len(m.lines), m.Y+m.Height) lines := m.lines[top:bottom] - return "\n" + strings.Join(lines, "\n") + + // Fill emtpy space with newlines + extraLines := "" + if len(lines) < m.Height { + extraLines = strings.Repeat("\n", m.Height-len(lines)) + } + + s := strings.Join(lines, "\n") + extraLines + return s } // ETC