A few tweaks
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user