summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-09 17:31:32 -0600
committerJeff Carr <[email protected]>2025-02-09 17:31:32 -0600
commit6df064282c1a912e606100f24584e10d2c1c5b24 (patch)
tree63664dfff77b1f249dd075bb521c84238764440f
parent6ea6ffaa3df04158ebb0df152aa9524653f903d4 (diff)
attempting to force the "Running..." box in the corner
-rw-r--r--eventMouseClick.go2
-rw-r--r--plugin.go10
-rw-r--r--textbox.go18
3 files changed, 22 insertions, 8 deletions
diff --git a/eventMouseClick.go b/eventMouseClick.go
index b250858..ed560a7 100644
--- a/eventMouseClick.go
+++ b/eventMouseClick.go
@@ -81,7 +81,7 @@ func doMouseClick(w int, h int) {
tk.showDropdown()
return
case widget.Textbox:
- tk.showTextbox()
+ tk.prepTextbox()
return
default:
// TODO: enable the GUI debugger in gocui
diff --git a/plugin.go b/plugin.go
index 6d9cb46..c8cafd0 100644
--- a/plugin.go
+++ b/plugin.go
@@ -229,9 +229,15 @@ func (tk *guiWidget) Disable() {
// log.Info("disable widget in gocui", tk.node.WidgetType, tk.node.ProgName())
switch tk.node.WidgetType {
case widget.Box:
- tk.labelN = "Running..."
// log.Info("todo: blank out the window here", tk.String())
- tk.showTextbox()
+ r := new(rectType)
+ // startW, startH := tk.Position()
+ r.w0 = 0
+ r.h0 = 0
+ r.w1 = r.w0 + 24
+ r.h1 = r.h0 + 2
+ me.textbox.tk.forceSizes(r)
+ showTextbox("Running...")
return
case widget.Button:
tk.setColorDisable()
diff --git a/textbox.go b/textbox.go
index 86b156f..bc5c902 100644
--- a/textbox.go
+++ b/textbox.go
@@ -29,7 +29,7 @@ func (tk *guiWidget) forceSizes(r *rectType) {
tk.force.h1 = r.h1
}
-func (callertk *guiWidget) showTextbox() {
+func (callertk *guiWidget) prepTextbox() {
if me.textbox.tk == nil {
// should only happen once
me.textbox.tk = makeNewFlagWidget(me.textbox.wId)
@@ -40,7 +40,6 @@ func (callertk *guiWidget) showTextbox() {
return
}
- // tk := me.textbox.tk
r := new(rectType)
// startW, startH := tk.Position()
r.w0 = callertk.gocuiSize.w0 + 4
@@ -50,6 +49,15 @@ func (callertk *guiWidget) showTextbox() {
me.textbox.tk.forceSizes(r)
// me.textbox.tk.dumpWidget("after sizes")
+ me.textbox.callerTK = callertk
+
+ showTextbox(callertk.String())
+}
+
+func showTextbox(callertk string) {
+ // tk := me.textbox.tk
+ // me.textbox.tk.dumpWidget("after sizes")
+
me.textbox.tk.Show() // actually makes the gocui view. TODO: redo this
if me.textbox.tk.v == nil {
@@ -59,13 +67,14 @@ func (callertk *guiWidget) showTextbox() {
me.textbox.tk.setColorModal()
me.textbox.tk.v.Clear()
- cur := strings.TrimSpace(callertk.String())
+ cur := strings.TrimSpace(callertk)
// log.Info("setting textbox string to:", cur)
me.textbox.tk.v.WriteString(cur)
me.textbox.tk.v.Editable = true
me.textbox.tk.v.Wrap = true
+ r := me.textbox.tk.gocuiSize
me.baseGui.SetView(me.textbox.tk.cuiName, r.w0, r.h0, r.w1, r.h1, 0)
me.baseGui.SetCurrentView(me.textbox.tk.v.Name())
@@ -73,9 +82,8 @@ func (callertk *guiWidget) showTextbox() {
me.baseGui.SetKeybinding(me.textbox.tk.v.Name(), gocui.KeyEnter, gocui.ModNone, theCloseTheTextbox)
me.textbox.active = true
- me.textbox.callerTK = callertk
- // tk.dumpWidget("showTextbox()")
+ // me.textbox.dumpWidget("showTextbox()")
}
func theCloseTheTextbox(g *gocui.Gui, v *gocui.View) error {