mirror of
https://github.com/Maks1mS/bubbles.git
synced 2024-12-25 07:04:37 +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 = 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()
|
||||||
@ -123,8 +123,8 @@ 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 {
|
||||||
@ -163,8 +163,8 @@ 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