summaryrefslogtreecommitdiff
path: root/eventBindingsStdout.go
diff options
context:
space:
mode:
Diffstat (limited to 'eventBindingsStdout.go')
-rw-r--r--eventBindingsStdout.go78
1 files changed, 78 insertions, 0 deletions
diff --git a/eventBindingsStdout.go b/eventBindingsStdout.go
new file mode 100644
index 0000000..1347c5c
--- /dev/null
+++ b/eventBindingsStdout.go
@@ -0,0 +1,78 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+import (
+ "fmt"
+
+ "github.com/awesome-gocui/gocui"
+ "go.wit.com/log"
+)
+
+func theStdout(g *gocui.Gui, v *gocui.View) error {
+ // me.stdout.pager = 0
+ infos := fmt.Sprintf("stdout moved off screen pager=%d len(%d) ", me.stdout.pager, len(me.stdout.outputS))
+ infos += fmt.Sprintf("last(%d,%d)", me.stdout.lastW, me.stdout.lastH)
+
+ if me.stdout.outputOnTop {
+ if me.stdout.outputOffscreen {
+ me.stdout.outputOffscreen = false
+ log.Info("stdout moved off screen", infos)
+ me.stdout.lastW = me.stdout.tk.gocuiSize.w0
+ me.stdout.lastH = me.stdout.tk.gocuiSize.h0
+ relocateStdoutOffscreen()
+ return nil
+ } else {
+ me.stdout.outputOffscreen = true
+ log.Info("stdout moved on screen", infos)
+ }
+ // move the stdout window back onscreen
+ me.stdout.tk.relocateStdout(me.stdout.lastW, me.stdout.lastH)
+ me.stdout.outputOnTop = false
+ setThingsOnTop()
+ // me.baseGui.SetViewOnBottom("msg")
+ // setBottomBG()
+ } else {
+ me.stdout.outputOnTop = true
+ setThingsOnTop()
+ // me.baseGui.SetViewOnTop("msg")
+ }
+ return nil
+}
+
+func stdoutPgup(g *gocui.Gui, v *gocui.View) error {
+ me.stdout.pager -= 40
+ if me.stdout.pager < 0 {
+ me.stdout.pager = 0
+ }
+ tk := me.stdout.tk
+ tk.refreshStdout()
+ return nil
+}
+
+func stdoutHome(g *gocui.Gui, v *gocui.View) error {
+ me.stdout.pager = 0
+ me.stdout.tk.refreshStdout()
+ return nil
+}
+
+func stdoutArrowUp(g *gocui.Gui, v *gocui.View) error {
+ me.stdout.pager += 1
+ me.stdout.tk.refreshStdout()
+ return nil
+}
+
+func stdoutArrowDown(g *gocui.Gui, v *gocui.View) error {
+ me.stdout.pager -= 1
+ me.stdout.tk.refreshStdout()
+ return nil
+}
+
+func stdoutPgdn(g *gocui.Gui, v *gocui.View) error {
+ me.stdout.pager += 10
+
+ tk := me.stdout.tk
+ tk.refreshStdout()
+ return nil
+}