From 46a87f913b8cd3a8f811e2a32d169d7722cefe0c Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Mon, 2 Feb 2026 13:38:33 -0600 Subject: [PATCH] Bug Fixes --- wdgt_linear_layout.go | 6 ++---- wdgt_stacked_layout.go | 42 ++++++++++++++++++------------------------ 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/wdgt_linear_layout.go b/wdgt_linear_layout.go index 0ef5f3d..d1c302c 100644 --- a/wdgt_linear_layout.go +++ b/wdgt_linear_layout.go @@ -285,8 +285,7 @@ func (w *LinearLayout) ActivateWidget(n Widget) { func (w *LinearLayout) ActivateNext() bool { var found bool for i := range w.widgets { - if found && w.widgets[i].Focusable() { - w.widgets[i].SetActive(true) + if found && w.widgets[i].SetActive(true) { return true } else if w.widgets[i].Active() { found = true @@ -299,8 +298,7 @@ func (w *LinearLayout) ActivateNext() bool { func (w *LinearLayout) ActivatePrev() bool { var found bool for i := len(w.widgets) - 1; i >= 0; i-- { - if found && w.widgets[i].Focusable() { - w.widgets[i].SetActive(true) + if found && w.widgets[i].SetActive(true) { return true } else if w.widgets[i].Active() { found = true diff --git a/wdgt_stacked_layout.go b/wdgt_stacked_layout.go index bf474ec..5416db5 100644 --- a/wdgt_stacked_layout.go +++ b/wdgt_stacked_layout.go @@ -79,8 +79,7 @@ func (w *ScrollingWidgetList) Init(id string, s tcell.Style) { if active == nil && len(w.widgets) > 0 { // No widget is active, but we do have some for i := range w.widgets { - if w.widgets[i].Focusable() { - w.widgets[i].SetActive(true) + if w.widgets[i].SetActive(true) { return true } } @@ -93,8 +92,7 @@ func (w *ScrollingWidgetList) Init(id string, s tcell.Style) { if active == nil && len(w.widgets) > 0 { // No widget is active, but we do have some for i := len(w.widgets) - 1; i >= 0; i-- { - if w.widgets[i].Focusable() { - w.widgets[i].SetActive(true) + if w.widgets[i].SetActive(true) { return true } } @@ -165,22 +163,20 @@ func (w *ScrollingWidgetList) SetActive(a bool) bool { } return w.active } -func (w *ScrollingWidgetList) Visible() bool { return w.visible } -func (w *ScrollingWidgetList) SetVisible(a bool) { w.visible = a } -func (w *ScrollingWidgetList) Focusable() bool { return w.focusable } -func (w *ScrollingWidgetList) SetFocusable(b bool) { w.focusable = b } -func (w *ScrollingWidgetList) SetX(x int) { w.x = x } -func (w *ScrollingWidgetList) SetY(y int) { w.y = y } -func (w *ScrollingWidgetList) GetX() int { return w.x } -func (w *ScrollingWidgetList) GetY() int { return w.y } -func (w *ScrollingWidgetList) GetPos() Coord { return Coord{X: w.x, Y: w.y} } -func (w *ScrollingWidgetList) SetPos(c Coord) { w.x, w.y = c.X, c.Y } -func (w *ScrollingWidgetList) GetW() int { return w.w } -func (w *ScrollingWidgetList) GetH() int { return w.h } -func (w *ScrollingWidgetList) SetW(wd int) { w.w = wd } -func (w *ScrollingWidgetList) SetH(h int) { w.h = h } -func (w *ScrollingWidgetList) getSize() Coord { return Coord{X: w.w, Y: w.h} } -func (w *ScrollingWidgetList) SetSize(c Coord) { w.w, w.h = c.X, c.Y } +func (w *ScrollingWidgetList) Visible() bool { return w.visible } +func (w *ScrollingWidgetList) SetVisible(a bool) { w.visible = a } +func (w *ScrollingWidgetList) SetX(x int) { w.x = x } +func (w *ScrollingWidgetList) SetY(y int) { w.y = y } +func (w *ScrollingWidgetList) GetX() int { return w.x } +func (w *ScrollingWidgetList) GetY() int { return w.y } +func (w *ScrollingWidgetList) GetPos() Coord { return Coord{X: w.x, Y: w.y} } +func (w *ScrollingWidgetList) SetPos(c Coord) { w.x, w.y = c.X, c.Y } +func (w *ScrollingWidgetList) GetW() int { return w.w } +func (w *ScrollingWidgetList) GetH() int { return w.h } +func (w *ScrollingWidgetList) SetW(wd int) { w.w = wd } +func (w *ScrollingWidgetList) SetH(h int) { w.h = h } +func (w *ScrollingWidgetList) getSize() Coord { return Coord{X: w.w, Y: w.h} } +func (w *ScrollingWidgetList) SetSize(c Coord) { w.w, w.h = c.X, c.Y } func (w *ScrollingWidgetList) WantW() int { var wantW int for _, wd := range w.widgets { @@ -284,8 +280,7 @@ func (w *ScrollingWidgetList) ActivateWidget(n Widget) { func (w *ScrollingWidgetList) ActivateNext() bool { var found bool for i := range w.widgets { - if found && w.widgets[i].Focusable() { - w.widgets[i].SetActive(true) + if found && w.widgets[i].SetActive(true) { return true } else if w.widgets[i].Active() { found = true @@ -298,8 +293,7 @@ func (w *ScrollingWidgetList) ActivateNext() bool { func (w *ScrollingWidgetList) ActivatePrev() bool { var found bool for i := len(w.widgets) - 1; i >= 0; i-- { - if found && w.widgets[i].Focusable() { - w.widgets[i].SetActive(true) + if found && w.widgets[i].SetActive(true) { return true } else if w.widgets[i].Active() { found = true