A few tweaks

This commit is contained in:
2025-08-20 10:53:18 -05:00
parent 599554a798
commit 0374e89b4f
5 changed files with 208 additions and 177 deletions

View File

@@ -74,12 +74,8 @@ func (w *Field) Init(id string, style tcell.Style) {
w.tabbable = true
}
func (w *Field) Id() string { return w.id }
func (w *Field) HandleResize(ev *tcell.EventResize) {
w.w, w.h = ev.Size()
// w.w = wh.Min(w.w, w.WantW())
// w.h = wh.Min(w.h, w.WantH())
}
func (w *Field) Id() string { return w.id }
func (w *Field) HandleResize(ev *tcell.EventResize) { w.w, w.h = ev.Size() }
func (w *Field) HandleKey(ev *tcell.EventKey) bool {
if !w.active {
@@ -152,7 +148,11 @@ func (w *Field) SetH(h int) { w.h = h }
func (w *Field) GetW() int { return w.w }
func (w *Field) GetH() int { return w.h }
func (w *Field) WantW() int {
return len(w.label) + 2 + len(w.value) + 1
if len(w.label) > 0 {
return len(w.label) + 2 + len(w.value) + 1
} else {
return len(w.value)
}
}
func (w *Field) WantH() int {