From 8cb2100c2844af0307b27c2fac3185dcce410bf4 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 26 Apr 2023 14:52:54 -0500 Subject: gocui: more correct logic Signed-off-by: Jeff Carr --- toolkit/gocui/add.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'toolkit/gocui/add.go') diff --git a/toolkit/gocui/add.go b/toolkit/gocui/add.go index 856b871..c649da5 100644 --- a/toolkit/gocui/add.go +++ b/toolkit/gocui/add.go @@ -44,16 +44,18 @@ func (w *cuiWidget) addWidget() { w.setFake() return case toolkit.Window: - w.setTabWH() - w.showView() + me.current = w + updateCurrentTabs() + setCurrentWindow(w) return case toolkit.Tab: - UnsetCurrent(me.rootNode) - me.rootNode.hideWidgets() - w.isCurrent = true - w.parent.isCurrent = true - w.placeWidgets() - w.showWidgets() + // if this is the first tab, set it to the current one and stay here + if (me.current != nil) { + // there is already a current tab. just redraw the tabs + updateCurrentTabs() + return + } + setCurrentTab(w) return case toolkit.Box: w.isFake = true -- cgit v1.2.3