summaryrefslogtreecommitdiff
path: root/eventBindings.go
diff options
context:
space:
mode:
Diffstat (limited to 'eventBindings.go')
-rw-r--r--eventBindings.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/eventBindings.go b/eventBindings.go
index e3f1994..eaf8d92 100644
--- a/eventBindings.go
+++ b/eventBindings.go
@@ -5,6 +5,7 @@ package main
import (
"fmt"
+ "slices"
"strings"
"syscall"
@@ -103,12 +104,28 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error {
}
func stdoutPgup(g *gocui.Gui, v *gocui.View) error {
- log.Info("try to page up in the stdout buffer here")
+ me.stdout.pager = 0
+ log.Info(fmt.Sprintf("try to page up in the stdout buffer here pager=%d len(%d)", me.stdout.pager, len(me.stdout.outputS)))
return nil
}
func stdoutPgdn(g *gocui.Gui, v *gocui.View) error {
- log.Info("try to page down in the stdout buffer here")
+ me.stdout.pager += 10
+ log.Info(fmt.Sprintf("try to page down in the stdout buffer here pager=%d len(%d)", me.stdout.pager, len(me.stdout.outputS)))
+ tk := me.stdout.tk
+
+ if len(me.stdout.outputS) < me.stdout.h+me.stdout.pager {
+ log.Info(fmt.Sprintf("buffer too small=%d len(%d)", me.stdout.pager, len(me.stdout.outputS)))
+ return nil
+ }
+
+ var cur []string
+ // chop off the last lines in the buffer
+ chop := len(me.stdout.outputS) - (me.stdout.pager + me.stdout.h)
+ cur = append(cur, me.stdout.outputS[chop:chop+me.stdout.h]...)
+ slices.Reverse(cur)
+ tk.v.Clear()
+ fmt.Fprintln(tk.v, strings.Join(cur, "\n"))
return nil
}