Some work
This commit is contained in:
@@ -113,10 +113,8 @@ func (w *Field) Draw(screen tcell.Screen) {
|
||||
if !w.visible {
|
||||
return
|
||||
}
|
||||
useStyle := w.style
|
||||
if w.active {
|
||||
useStyle = w.style.Bold(true)
|
||||
}
|
||||
useStyle := w.style.Dim(!w.active)
|
||||
valueStyle := useStyle.Bold(w.active)
|
||||
x := w.x
|
||||
labelW := len(w.label)
|
||||
if labelW > 0 {
|
||||
@@ -133,15 +131,15 @@ func (w *Field) Draw(screen tcell.Screen) {
|
||||
}
|
||||
}
|
||||
|
||||
wh.DrawText(x, w.y, pre, useStyle, screen)
|
||||
wh.DrawText(x, w.y, pre, valueStyle, screen)
|
||||
x += len(pre)
|
||||
if w.active {
|
||||
wh.DrawText(x, w.y, cursor, useStyle.Reverse(true).Blink(true), screen)
|
||||
wh.DrawText(x, w.y, cursor, valueStyle.Reverse(true).Blink(true), screen)
|
||||
} else {
|
||||
wh.DrawText(x, w.y, cursor, useStyle, screen)
|
||||
wh.DrawText(x, w.y, cursor, valueStyle, screen)
|
||||
}
|
||||
x += 1
|
||||
wh.DrawText(x, w.y, post, useStyle, screen)
|
||||
wh.DrawText(x, w.y, post, valueStyle, screen)
|
||||
}
|
||||
|
||||
func (w *Field) Active() bool { return w.active }
|
||||
@@ -159,21 +157,24 @@ 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 {
|
||||
vM := wh.Max(40, len(w.value))
|
||||
if len(w.label) > 0 {
|
||||
return len(w.label) + 2 + len(w.value) + 1
|
||||
} else {
|
||||
return len(w.value)
|
||||
return len(w.label) + vM + 3
|
||||
}
|
||||
return vM
|
||||
}
|
||||
|
||||
func (w *Field) WantH() int {
|
||||
return 1
|
||||
func (w *Field) WantH() int { return 1 }
|
||||
func (w *Field) SetSize(c Coord) {
|
||||
w.SetW(c.X)
|
||||
w.SetH(c.Y)
|
||||
}
|
||||
func (w *Field) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
||||
func (w *Field) Focusable() bool { return w.focusable }
|
||||
func (w *Field) SetFocusable(b bool) { w.focusable = b }
|
||||
func (w *Field) MinW() int { return len(w.label) + wh.Max(15, len(w.value)) }
|
||||
func (w *Field) MinH() int { return 1 }
|
||||
func (w *Field) MinW() int {
|
||||
return len(w.label) + len(w.value)
|
||||
}
|
||||
func (w *Field) MinH() int { return 1 }
|
||||
|
||||
/* Non-Widget-Interface Functions */
|
||||
func (w *Field) handleBackspace(_ *tcell.EventKey) bool {
|
||||
|
||||
Reference in New Issue
Block a user