diff options
| author | Jeff Carr <[email protected]> | 2025-02-06 19:00:00 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-06 19:00:00 -0600 |
| commit | 2a5734892a85804b6c44a0cd8dd22d20fed21d96 (patch) | |
| tree | 55e4164094dd468a8ef1812ed1cae5e7a605fc01 /eventBindings.go | |
| parent | f5d465901d2ec48e145c3c7ce04eceb69445a11f (diff) | |
trying to fix Hidden() to use the parent
Diffstat (limited to 'eventBindings.go')
| -rw-r--r-- | eventBindings.go | 21 |
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 } |
