mirror of
https://github.com/Maks1mS/bubbles.git
synced 2024-12-25 15:04:39 +03:00
Fix cases where pager would add blank lines to bottom of document
This commit is contained in:
parent
dbb1d93970
commit
185a19e56f
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user