scrolling bounds checks

This commit is contained in:
Felix Angell 2018-04-15 19:23:35 +01:00
parent 7c4706356b
commit 112cdc74d6

View File

@ -370,13 +370,15 @@ func (b *Buffer) scrollUp() {
}
func (b *Buffer) scrollDown() {
// TODO move the cursor down 45 lines
// IF the buffer exceeds the window size.
lineScrollAmount := 10
if b.cam.y < len(b.contents) {
// TODO move the cursor down 45 lines
// IF the buffer exceeds the window size.
lineScrollAmount := 10
b.cam.y += lineScrollAmount
for i := 0; i < lineScrollAmount; i++ {
b.moveDown()
b.cam.y += lineScrollAmount
for i := 0; i < lineScrollAmount; i++ {
b.moveDown()
}
}
}