CLI Widget
This commit is contained in:
7
cli.go
7
cli.go
@@ -62,6 +62,7 @@ func NewCli(id string, s tcell.Style) *Cli {
|
||||
|
||||
func (w *Cli) Init(id string, s tcell.Style) {
|
||||
w.id, w.style = id, s
|
||||
w.visible = true
|
||||
}
|
||||
|
||||
func (w *Cli) Id() string { return w.id }
|
||||
@@ -179,7 +180,7 @@ func (w *Cli) Draw(screen tcell.Screen) {
|
||||
}
|
||||
dStyle := w.style
|
||||
if !w.active {
|
||||
w.style = dStyle.Dim(true)
|
||||
dStyle = dStyle.Dim(true)
|
||||
}
|
||||
h.Border(w.x, w.y, w.x+w.w-1, w.y+w.h, h.BRD_SIMPLE, dStyle, screen)
|
||||
x, y := w.x+1, w.y+1+w.h-3
|
||||
@@ -189,7 +190,7 @@ func (w *Cli) Draw(screen tcell.Screen) {
|
||||
if len(line) > w.w-2 {
|
||||
line = line[:w.w-2]
|
||||
}
|
||||
h.DrawText(x, y, line, dStyle, screen)
|
||||
h.DrawText(x, y, h.PadR(line, w.w), dStyle, screen)
|
||||
y--
|
||||
}
|
||||
}
|
||||
@@ -208,7 +209,7 @@ func (w *Cli) Draw(screen tcell.Screen) {
|
||||
x += len(pre)
|
||||
h.DrawText(x, y, cursor, dStyle.Reverse(w.active), screen)
|
||||
x += 1
|
||||
h.DrawText(x, y, post, dStyle, screen)
|
||||
h.DrawText(x, y, h.PadR(post, w.w-x), dStyle, screen)
|
||||
// x += len(post) - 1
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user