aboutsummaryrefslogtreecommitdiff
path: root/go/ui/buffer.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-03 14:05:14 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-27 16:43:46 +0100
commit642b2e14532f906fe133bf2d05bb132ebb53d9ef (patch)
treeda45eeb332bc786c998f8b64a69585ff36c031e5 /go/ui/buffer.go
parent6034149d014e999b17247af75b98913e4e4c68af (diff)
downloadmuhqs-game-642b2e14532f906fe133bf2d05bb132ebb53d9ef.tar.gz
muhqs-game-642b2e14532f906fe133bf2d05bb132ebb53d9ef.zip
add text input and properly center text
Diffstat (limited to 'go/ui/buffer.go')
-rw-r--r--go/ui/buffer.go13
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()
+}