diff options
Diffstat (limited to 'go/ui/buffer.go')
| -rw-r--r-- | go/ui/buffer.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/go/ui/buffer.go b/go/ui/buffer.go index c451d7fc..e95102fe 100644 --- a/go/ui/buffer.go +++ b/go/ui/buffer.go @@ -64,3 +64,16 @@ func (b *Buffer) Remove(idx int) { b.lines = append(b.lines[:idx], b.lines[idx+1:]...) b.ForceRedraw() } + +func (b *Buffer) Scroll(x, y int) { + if y == 0 { + return + } + + if y < 0 && b.pos > 0 { + b.pos-- + } else if y > 0 && b.pos < len(b.lines)-1 { + b.pos++ + } + b.ForceRedraw() +} |
