summaryrefslogtreecommitdiff
path: root/eventBindingsStdout.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-25 08:56:33 -0500
committerJeff Carr <[email protected]>2025-03-25 13:17:00 -0500
commit36514cbb6818dd06e13b2dff20fa4f0ac67ce545 (patch)
treeb9f454146b7c2c54ea17cf4e60f230e91a18e6b3 /eventBindingsStdout.go
parent1552eedc185e85b46498898e68867afaef308301 (diff)
fix arrow up & down on scrolling stdout
Diffstat (limited to 'eventBindingsStdout.go')
-rw-r--r--eventBindingsStdout.go26
1 files changed, 22 insertions, 4 deletions
diff --git a/eventBindingsStdout.go b/eventBindingsStdout.go
index f1c574e..8387ea2 100644
--- a/eventBindingsStdout.go
+++ b/eventBindingsStdout.go
@@ -77,14 +77,12 @@ func stdoutHome(g *gocui.Gui, v *gocui.View) error {
}
func stdoutArrowUp(g *gocui.Gui, v *gocui.View) error {
- me.stdout.pager += 1
- me.stdout.tk.refreshStdout()
+ stdoutWheelsUp()
return nil
}
func stdoutArrowDown(g *gocui.Gui, v *gocui.View) error {
- me.stdout.pager -= 1
- me.stdout.tk.refreshStdout()
+ stdoutWheelsDown()
return nil
}
@@ -103,3 +101,23 @@ func stdoutPgdn(g *gocui.Gui, v *gocui.View) error {
tk.refreshStdout()
return nil
}
+
+// scrolling up with the mouse wheel (or trackpad)
+func stdoutWheelsUp() {
+ // log.Info("private wheels up")
+ me.stdout.pager -= 2
+ if me.stdout.pager < 0 {
+ me.stdout.pager = 0
+ }
+ me.stdout.tk.refreshStdout()
+}
+
+// scrolling down with the mouse wheel (or trackpad)
+func stdoutWheelsDown() {
+ // log.Info("you've landed")
+ me.stdout.pager += 2
+ if me.stdout.pager > len(me.stdout.outputS) {
+ me.stdout.pager = len(me.stdout.outputS)
+ }
+ me.stdout.tk.refreshStdout()
+}