Things are working pretty well now

This commit is contained in:
2026-02-02 14:11:01 -06:00
parent f3c63fe95b
commit 486c07f2d4
9 changed files with 442 additions and 136 deletions

View File

@@ -40,11 +40,10 @@ type JsonContent struct {
x, y int
w, h int
border []rune
visible bool
active bool
focusable bool
keyMap *wd.KeyMap
border []rune
visible bool
active bool
keyMap *wd.KeyMap
editable bool
value any
@@ -67,7 +66,6 @@ func (w *JsonContent) Init(id string, style tcell.Style) {
w.id = id
w.style = style
w.visible = true
w.focusable = false
w.keyMap = wd.NewKeyMap(
wd.NewKey(wd.BuildEK(tcell.KeyUp), func(_ *tcell.EventKey) bool { return w.MoveUp() }),
wd.NewKey(wd.BuildEK(tcell.KeyDown), func(_ *tcell.EventKey) bool { return w.MoveDown() }),
@@ -174,26 +172,27 @@ func (w *JsonContent) Draw(screen tcell.Screen) {
func (w *JsonContent) SetStyle(s tcell.Style) { w.style = s }
func (w *JsonContent) Active() bool { return w.active }
func (w *JsonContent) SetActive(a bool) { w.active = a }
func (w *JsonContent) Visible() bool { return w.visible }
func (w *JsonContent) SetVisible(a bool) { w.visible = a }
func (w *JsonContent) SetX(x int) { w.x = x }
func (w *JsonContent) SetY(y int) { w.y = y }
func (w *JsonContent) GetX() int { return w.x }
func (w *JsonContent) GetY() int { return w.y }
func (w *JsonContent) GetPos() wd.Coord { return wd.Coord{X: w.x, Y: w.y} }
func (w *JsonContent) SetPos(c wd.Coord) { w.x, w.y = c.X, c.Y }
func (w *JsonContent) SetW(x int) { w.w = x }
func (w *JsonContent) SetH(y int) { w.h = y }
func (w *JsonContent) GetW() int { return w.w }
func (w *JsonContent) GetH() int { return w.h }
func (w *JsonContent) WantW() int { return wh.Longest(w.contents) }
func (w *JsonContent) WantH() int { return len(w.contents) }
func (w *JsonContent) SetSize(c wd.Coord) { w.w, w.h = c.X, c.Y }
func (w *JsonContent) Focusable() bool { return w.focusable }
func (w *JsonContent) SetFocusable(b bool) { w.focusable = b }
func (w *JsonContent) MinW() int { return wh.Longest(w.contents) }
func (w *JsonContent) MinH() int { return len(w.contents) }
func (w *JsonContent) SetActive(a bool) bool {
w.active = a
return w.active
}
func (w *JsonContent) Visible() bool { return w.visible }
func (w *JsonContent) SetVisible(a bool) { w.visible = a }
func (w *JsonContent) SetX(x int) { w.x = x }
func (w *JsonContent) SetY(y int) { w.y = y }
func (w *JsonContent) GetX() int { return w.x }
func (w *JsonContent) GetY() int { return w.y }
func (w *JsonContent) GetPos() wd.Coord { return wd.Coord{X: w.x, Y: w.y} }
func (w *JsonContent) SetPos(c wd.Coord) { w.x, w.y = c.X, c.Y }
func (w *JsonContent) SetW(x int) { w.w = x }
func (w *JsonContent) SetH(y int) { w.h = y }
func (w *JsonContent) GetW() int { return w.w }
func (w *JsonContent) GetH() int { return w.h }
func (w *JsonContent) WantW() int { return wh.Longest(w.contents) }
func (w *JsonContent) WantH() int { return len(w.contents) }
func (w *JsonContent) SetSize(c wd.Coord) { w.w, w.h = c.X, c.Y }
func (w *JsonContent) MinW() int { return wh.Longest(w.contents) }
func (w *JsonContent) MinH() int { return len(w.contents) }
func (w *JsonContent) SetValue(v any) error {
w.value = v