diff options
Diffstat (limited to 'eventBindingsStdout.go')
| -rw-r--r-- | eventBindingsStdout.go | 26 |
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() +} |
