summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debug.go3
-rw-r--r--eventBindings.go14
-rw-r--r--eventBindingsStdout.go26
-rw-r--r--find.go14
-rw-r--r--init.go14
5 files changed, 37 insertions, 34 deletions
diff --git a/debug.go b/debug.go
index 490b113..0e3ae94 100644
--- a/debug.go
+++ b/debug.go
@@ -86,7 +86,8 @@ func (tk *guiWidget) dumpWidget(s string) {
} else {
end = fmt.Sprintf("%-8s %-8s %s", tk.WidgetType(), tk.cuiName, tk.String())
}
- if tk.findParentTable() != nil {
+ if tk.node.InTable() {
+ // log.Log(GOCUI, "findParentTAble()", tk.labelN, tk.cuiName, tk.node.WidgetId)
end += " (table)"
}
log.Log(GOCUI, s1, s, end)
diff --git a/eventBindings.go b/eventBindings.go
index 9819706..acc25a8 100644
--- a/eventBindings.go
+++ b/eventBindings.go
@@ -109,22 +109,12 @@ func theDarkness(g *gocui.Gui, v *gocui.View) error {
}
func wheelsUp(g *gocui.Gui, v *gocui.View) error {
- // log.Info("private wheels up")
- me.stdout.pager -= 2
- if me.stdout.pager < 0 {
- me.stdout.pager = 0
- }
- me.stdout.tk.refreshStdout()
+ stdoutWheelsUp()
return nil
}
func wheelsDown(g *gocui.Gui, v *gocui.View) error {
- // 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()
+ stdoutWheelsDown()
return nil
}
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()
+}
diff --git a/find.go b/find.go
index 13d9c0e..2cb94f3 100644
--- a/find.go
+++ b/find.go
@@ -186,20 +186,6 @@ func (tk *guiWidget) findParentWindow() *guiWidget {
return tk.parent.findParentWindow()
}
-func (tk *guiWidget) findParentTable() *guiWidget {
- if tk.isTable {
- log.Info("findParentTAble()", tk.labelN, tk.cuiName, tk.node.WidgetId)
- return tk
- }
- if tk.node.WidgetId == 0 {
- return nil
- }
- if tk.parent == nil {
- return nil
- }
- return tk.parent.findParentWindow()
-}
-
func (tk *guiWidget) findWidgetByName(name string) *guiWidget {
if tk.cuiName == name {
return tk
diff --git a/init.go b/init.go
index 2820bcf..71ac4b2 100644
--- a/init.go
+++ b/init.go
@@ -148,6 +148,12 @@ func initPlugin() {
me.stdout.disable = true
}
}
+ if val, err := me.myTree.ConfigFind("stdoutoffscreen"); err == nil {
+ if val == "false" {
+ // log.Log(NOW, "gocui: START ON SCREEN TRUE")
+ me.stdout.startOnscreen = true
+ }
+ }
if val, err := me.myTree.ConfigFind("dark"); err == nil {
if val == "true" {
me.dark = true
@@ -190,11 +196,12 @@ func initPlugin() {
if val, err := me.myTree.ConfigFind("stdoutsize"); err == nil {
parts := strings.Fields(val)
if len(parts) == 4 {
- log.Info("initial stdout settings:", parts)
+ log.Info("initial stdout settings:", parts, "setting startOnscreen = true")
me.stdout.w, _ = strconv.Atoi(parts[0])
me.stdout.h, _ = strconv.Atoi(parts[1])
me.stdout.lastW, _ = strconv.Atoi(parts[2])
me.stdout.lastH, _ = strconv.Atoi(parts[3])
+ me.stdout.startOnscreen = true
} else {
log.Info("initial stdout settings parse error:", parts)
}
@@ -393,9 +400,8 @@ func refreshGocui() {
me.refresh = false
}
if me.stdout.changed {
- log.Log(NOW, "newWindowTrigger() TODO: gocui should save the stdout size & location here")
me.stdout.changed = false
- me.stdout.tk.dumpWidget("save")
+ lastRefresh = time.Now()
new1 := new(tree.ToolkitConfig)
new1.Plugin = "gocui"
new1.Name = "stdoutsize"
@@ -403,6 +409,8 @@ func refreshGocui() {
height := me.stdout.tk.gocuiSize.h1 - me.stdout.tk.gocuiSize.h0
new1.Value = fmt.Sprintf("%d %d %d %d", width, height, me.stdout.tk.gocuiSize.w0, me.stdout.tk.gocuiSize.h0)
me.myTree.ConfigSave(new1)
+ // log.Log(NOW, "newWindowTrigger() gocui setting stdout size =", new1.Value)
+ // me.stdout.tk.dumpWidget("save")
}
}