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