summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-26 16:06:55 -0500
committerJeff Carr <[email protected]>2023-04-26 16:06:55 -0500
commit5b217fa23af4e5040d5f09d9840ddc426a315960 (patch)
tree1c76dc4a40d7836c83561267055294e4d2feec02
parent8cb2100c2844af0307b27c2fac3185dcce410bf4 (diff)
gocui: update on add kinda working now
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--toolkit/gocui/add.go3
-rw-r--r--toolkit/gocui/click.go22
2 files changed, 25 insertions, 0 deletions
diff --git a/toolkit/gocui/add.go b/toolkit/gocui/add.go
index c649da5..3020c83 100644
--- a/toolkit/gocui/add.go
+++ b/toolkit/gocui/add.go
@@ -80,6 +80,9 @@ func (w *cuiWidget) addWidget() {
default:
w.startW = w.parent.startW
w.startH = w.parent.startH
+ if w.IsCurrent() {
+ w.updateCurrent()
+ }
}
w.showWidgetPlacement(logInfo, "addWidget()")
}
diff --git a/toolkit/gocui/click.go b/toolkit/gocui/click.go
index f0f325e..1da32e9 100644
--- a/toolkit/gocui/click.go
+++ b/toolkit/gocui/click.go
@@ -25,6 +25,28 @@ func updateCurrentTabs() {
me.rootNode.redoTabs(true)
}
+// when adding a new widget, this will update the display
+// of the current widgets if that widget is supposed
+// to be in current display
+func (w *cuiWidget) updateCurrent() {
+ if w.widgetType == toolkit.Tab {
+ if w.IsCurrent() {
+ setCurrentTab(w)
+ }
+ return
+ }
+ if w.widgetType == toolkit.Window {
+ if w.IsCurrent() {
+ setCurrentWindow(w)
+ }
+ return
+ }
+ if w.widgetType == toolkit.Root {
+ return
+ }
+ w.parent.updateCurrent()
+}
+
// shows the widgets in a window
func setCurrentWindow(w *cuiWidget) {
if w.widgetType != toolkit.Window {