So much work

This commit is contained in:
2025-08-06 16:15:08 -05:00
parent 1474caffaa
commit 81c7ec8324
20 changed files with 1386 additions and 376 deletions

View File

@@ -35,11 +35,12 @@ type Field struct {
label string
value string
cursor int
visible bool
active bool
x, y int
w, h int
cursor int
visible bool
active bool
tabbable bool
x, y int
w, h int
filter func(*tcell.EventKey) bool
onChange func(prev, curr string)
@@ -70,10 +71,11 @@ func (w *Field) Init(id string, style tcell.Style) {
tcell.KeyEnd: w.handleEnd,
tcell.KeyCtrlU: w.clearValueBeforeCursor,
})
w.tabbable = true
}
func (w *Field) Id() string { return w.id }
func (w *Field) HandleResize(ev *tcell.EventResize) {}
func (w *Field) HandleResize(ev *tcell.EventResize) { w.w, w.h = ev.Size() }
func (w *Field) HandleKey(ev *tcell.EventKey) bool {
if !w.active {
return false
@@ -137,6 +139,7 @@ func (w *Field) SetX(x int) { w.x = x }
func (w *Field) SetY(y int) { w.y = y }
func (w *Field) GetX() int { return w.x }
func (w *Field) GetY() int { return w.y }
func (w *Field) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
func (w *Field) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
func (w *Field) SetW(wd int) { w.w = wd }
func (w *Field) SetH(h int) { w.h = h }
@@ -149,8 +152,12 @@ func (w *Field) WantW() int {
func (w *Field) WantH() int {
return 1
}
func (w *Field) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
func (w *Field) Focusable() bool { return true }
func (w *Field) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
func (w *Field) Focusable() bool { return true }
func (w *Field) SetTabbable(b bool) { w.tabbable = b }
func (w *Field) Tabbable() bool { return w.tabbable }
func (w *Field) MinW() int { return len(w.label) + 15 }
func (w *Field) MinH() int { return 1 }
/* Non-Widget-Interface Functions */
func (w *Field) handleBackspace(ev *tcell.EventKey) bool {