forked from Mirrors/bubbletea
Correct "scroll down" behavior
This commit is contained in:
parent
2110a923ab
commit
902225116c
|
@ -231,7 +231,7 @@ func (r *renderer) insertBottom(lines []string, topBoundary, bottomBoundary int)
|
||||||
|
|
||||||
saveCursorPosition(b)
|
saveCursorPosition(b)
|
||||||
changeScrollingRegion(b, topBoundary, bottomBoundary)
|
changeScrollingRegion(b, topBoundary, bottomBoundary)
|
||||||
moveCursor(b, topBoundary, 0)
|
moveCursor(b, bottomBoundary, 0)
|
||||||
_, _ = io.WriteString(b, "\r\n"+strings.Join(lines, "\r\n"))
|
_, _ = io.WriteString(b, "\r\n"+strings.Join(lines, "\r\n"))
|
||||||
changeScrollingRegion(b, 0, r.height)
|
changeScrollingRegion(b, 0, r.height)
|
||||||
restoreCursorPosition(b)
|
restoreCursorPosition(b)
|
||||||
|
@ -261,7 +261,7 @@ func (r *renderer) handleMessages(msg Msg) {
|
||||||
r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary)
|
r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary)
|
||||||
|
|
||||||
case scrollDownMsg:
|
case scrollDownMsg:
|
||||||
r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary)
|
r.insertBottom(msg.lines, msg.topBoundary, msg.bottomBoundary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue