diff options
Diffstat (limited to 'init.go')
| -rw-r--r-- | init.go | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -14,10 +14,13 @@ import ( "runtime" "runtime/debug" "runtime/pprof" + "strconv" + "strings" "time" "github.com/awesome-gocui/gocui" "go.wit.com/log" + "go.wit.com/toolkits/tree" ) // sent via -ldflags @@ -184,6 +187,19 @@ func initPlugin() { me.stdout.lastW = 4 me.stdout.lastH = 20 + if val, err := me.myTree.ConfigFind("stdoutsize"); err == nil { + parts := strings.Fields(val) + if len(parts) == 4 { + log.Info("initial stdout settings:", parts) + 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]) + } else { + log.Info("initial stdout settings parse error:", parts) + } + } + // just make up unique values for these me.dropdown.wId = -77 me.textbox.wId = -55 @@ -376,6 +392,18 @@ func refreshGocui() { me.newWindowTrigger <- me.treeRoot.TK.(*guiWidget) 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") + new1 := new(tree.ToolkitConfig) + new1.Plugin = "gocui" + new1.Name = "stdoutsize" + width := me.stdout.tk.gocuiSize.w1 - me.stdout.tk.gocuiSize.w0 + 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) + } } // this code updates the clock |
