Bug Fixes

This commit is contained in:
2026-02-02 13:35:13 -06:00
parent 16a92c8f99
commit 5581cf14c1
4 changed files with 35 additions and 45 deletions

View File

@@ -58,7 +58,6 @@ func (w *BorderedWidget) Init(id string, s tcell.Style) {
w.style = s w.style = s
w.widget.SetVisible(true) w.widget.SetVisible(true)
w.border = wh.BRD_CSIMPLE w.border = wh.BRD_CSIMPLE
w.widget.SetFocusable(true)
} }
func (w *BorderedWidget) Id() string { return w.id } func (w *BorderedWidget) Id() string { return w.id }
@@ -96,8 +95,6 @@ func (w *BorderedWidget) Active() bool { return w.widget.Active() }
func (w *BorderedWidget) SetActive(a bool) bool { return w.widget.SetActive(a) } func (w *BorderedWidget) SetActive(a bool) bool { return w.widget.SetActive(a) }
func (w *BorderedWidget) Visible() bool { return w.widget.Visible() } func (w *BorderedWidget) Visible() bool { return w.widget.Visible() }
func (w *BorderedWidget) SetVisible(a bool) { w.SetVisible(a) } func (w *BorderedWidget) SetVisible(a bool) { w.SetVisible(a) }
func (w *BorderedWidget) Focusable() bool { return w.widget.Focusable() }
func (w *BorderedWidget) SetFocusable(b bool) { w.widget.SetFocusable(b) }
func (w *BorderedWidget) SetX(x int) { w.x = x } func (w *BorderedWidget) SetX(x int) { w.x = x }
func (w *BorderedWidget) SetY(y int) { w.y = y } func (w *BorderedWidget) SetY(y int) { w.y = y }
func (w *BorderedWidget) GetX() int { return w.x } func (w *BorderedWidget) GetX() int { return w.x }

View File

@@ -148,9 +148,10 @@ func (w *Form) Draw(screen tcell.Screen) {
func (w *Form) SetStyle(s tcell.Style) { w.style = s } func (w *Form) SetStyle(s tcell.Style) { w.style = s }
func (w *Form) Active() bool { return w.active } func (w *Form) Active() bool { return w.active }
func (w *Form) SetActive(a bool) { func (w *Form) SetActive(a bool) bool {
w.active = a w.active = a
w.updateWidgets() w.updateWidgets()
return w.active
} }
func (w *Form) Visible() bool { return w.visible } func (w *Form) Visible() bool { return w.visible }
func (w *Form) SetVisible(a bool) { w.visible = a } func (w *Form) SetVisible(a bool) { w.visible = a }

View File

@@ -52,7 +52,6 @@ type LinearLayout struct {
active bool active bool
visible bool visible bool
focusable bool
disableTab bool disableTab bool
insetBorder bool insetBorder bool
@@ -80,7 +79,6 @@ func (w *LinearLayout) Init(id string, s tcell.Style) {
w.id = id w.id = id
w.style = s w.style = s
w.visible = true w.visible = true
w.focusable = true
w.defFlags = LayoutFlag(LFAlignHCenter | LFAlignVCenter) w.defFlags = LayoutFlag(LFAlignHCenter | LFAlignVCenter)
w.layoutFlags = make(map[Widget]LayoutFlag) w.layoutFlags = make(map[Widget]LayoutFlag)
w.layoutWeights = make(map[Widget]int) w.layoutWeights = make(map[Widget]int)
@@ -89,8 +87,7 @@ func (w *LinearLayout) Init(id string, s tcell.Style) {
if active == nil && len(w.widgets) > 0 { if active == nil && len(w.widgets) > 0 {
// No widget is active, but we do have some // No widget is active, but we do have some
for i := range w.widgets { for i := range w.widgets {
if w.widgets[i].Focusable() { if w.widgets[i].SetActive(true) {
w.widgets[i].SetActive(true)
return true return true
} }
} }
@@ -103,8 +100,7 @@ func (w *LinearLayout) Init(id string, s tcell.Style) {
if active == nil && len(w.widgets) > 0 { if active == nil && len(w.widgets) > 0 {
// No widget is active, but we do have some // No widget is active, but we do have some
for i := len(w.widgets) - 1; i >= 0; i-- { for i := len(w.widgets) - 1; i >= 0; i-- {
if w.widgets[i].Focusable() { if w.widgets[i].SetActive(true) {
w.widgets[i].SetActive(true)
return true return true
} }
} }
@@ -172,22 +168,20 @@ func (w *LinearLayout) SetActive(a bool) bool {
} }
return w.active return w.active
} }
func (w *LinearLayout) Visible() bool { return w.visible } func (w *LinearLayout) Visible() bool { return w.visible }
func (w *LinearLayout) SetVisible(a bool) { w.visible = a } func (w *LinearLayout) SetVisible(a bool) { w.visible = a }
func (w *LinearLayout) Focusable() bool { return w.focusable } func (w *LinearLayout) SetX(x int) { w.x = x }
func (w *LinearLayout) SetFocusable(b bool) { w.focusable = b } func (w *LinearLayout) SetY(y int) { w.y = y }
func (w *LinearLayout) SetX(x int) { w.x = x } func (w *LinearLayout) GetX() int { return w.x }
func (w *LinearLayout) SetY(y int) { w.y = y } func (w *LinearLayout) GetY() int { return w.y }
func (w *LinearLayout) GetX() int { return w.x } func (w *LinearLayout) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
func (w *LinearLayout) GetY() int { return w.y } func (w *LinearLayout) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
func (w *LinearLayout) GetPos() Coord { return Coord{X: w.x, Y: w.y} } func (w *LinearLayout) GetW() int { return w.w }
func (w *LinearLayout) SetPos(c Coord) { w.x, w.y = c.X, c.Y } func (w *LinearLayout) GetH() int { return w.h }
func (w *LinearLayout) GetW() int { return w.w } func (w *LinearLayout) SetW(wd int) { w.w = wd }
func (w *LinearLayout) GetH() int { return w.h } func (w *LinearLayout) SetH(h int) { w.h = h }
func (w *LinearLayout) SetW(wd int) { w.w = wd } func (w *LinearLayout) getSize() Coord { return Coord{X: w.w, Y: w.h} }
func (w *LinearLayout) SetH(h int) { w.h = h } func (w *LinearLayout) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
func (w *LinearLayout) getSize() Coord { return Coord{X: w.w, Y: w.h} }
func (w *LinearLayout) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
func (w *LinearLayout) WantW() int { func (w *LinearLayout) WantW() int {
var wantW int var wantW int
for _, wd := range w.widgets { for _, wd := range w.widgets {

View File

@@ -51,22 +51,20 @@ func (w *ShrinkWrap) Active() bool { return w.widget.Active() }
func (w *ShrinkWrap) SetActive(a bool) bool { func (w *ShrinkWrap) SetActive(a bool) bool {
return w.widget.SetActive(a) return w.widget.SetActive(a)
} }
func (w *ShrinkWrap) Visible() bool { return w.widget.Visible() } func (w *ShrinkWrap) Visible() bool { return w.widget.Visible() }
func (w *ShrinkWrap) SetVisible(v bool) { w.widget.SetVisible(v) } func (w *ShrinkWrap) SetVisible(v bool) { w.widget.SetVisible(v) }
func (w *ShrinkWrap) Focusable() bool { return w.widget.Focusable() } func (w *ShrinkWrap) SetX(x int) { w.widget.SetX(x) }
func (w *ShrinkWrap) SetFocusable(t bool) { w.widget.SetFocusable(t) } func (w *ShrinkWrap) SetY(y int) { w.widget.SetY(y) }
func (w *ShrinkWrap) SetX(x int) { w.widget.SetX(x) } func (w *ShrinkWrap) GetX() int { return w.widget.GetX() }
func (w *ShrinkWrap) SetY(y int) { w.widget.SetY(y) } func (w *ShrinkWrap) GetY() int { return w.widget.GetY() }
func (w *ShrinkWrap) GetX() int { return w.widget.GetX() } func (w *ShrinkWrap) GetPos() Coord { return w.widget.GetPos() }
func (w *ShrinkWrap) GetY() int { return w.widget.GetY() } func (w *ShrinkWrap) SetPos(pos Coord) { w.widget.SetPos(pos) }
func (w *ShrinkWrap) GetPos() Coord { return w.widget.GetPos() } func (w *ShrinkWrap) SetSize(size Coord) { w.widget.SetSize(size) }
func (w *ShrinkWrap) SetPos(pos Coord) { w.widget.SetPos(pos) } func (w *ShrinkWrap) SetW(wd int) { w.widget.SetW(wd) }
func (w *ShrinkWrap) SetSize(size Coord) { w.widget.SetSize(size) } func (w *ShrinkWrap) SetH(h int) { w.widget.SetH(h) }
func (w *ShrinkWrap) SetW(wd int) { w.widget.SetW(wd) } func (w *ShrinkWrap) GetW() int { return w.widget.GetW() }
func (w *ShrinkWrap) SetH(h int) { w.widget.SetH(h) } func (w *ShrinkWrap) GetH() int { return w.widget.GetH() }
func (w *ShrinkWrap) GetW() int { return w.widget.GetW() } func (w *ShrinkWrap) WantW() int { return w.widget.MinW() }
func (w *ShrinkWrap) GetH() int { return w.widget.GetH() } func (w *ShrinkWrap) WantH() int { return w.widget.MinH() }
func (w *ShrinkWrap) WantW() int { return w.widget.MinW() } func (w *ShrinkWrap) MinW() int { return w.widget.MinW() }
func (w *ShrinkWrap) WantH() int { return w.widget.MinH() } func (w *ShrinkWrap) MinH() int { return w.widget.MinH() }
func (w *ShrinkWrap) MinW() int { return w.widget.MinW() }
func (w *ShrinkWrap) MinH() int { return w.widget.MinH() }