Some Updates
This commit is contained in:
21
wdgt_cli.go
21
wdgt_cli.go
@@ -40,6 +40,7 @@ type Cli struct {
|
||||
active bool
|
||||
visible bool
|
||||
focusable bool
|
||||
minimized bool
|
||||
|
||||
title string
|
||||
rawLog []string
|
||||
@@ -77,6 +78,9 @@ func (w *Cli) Init(id string, s tcell.Style) {
|
||||
func (w *Cli) Id() string { return w.id }
|
||||
func (w *Cli) HandleResize(ev *tcell.EventResize) {
|
||||
w.w, w.h = ev.Size()
|
||||
if w.minimized {
|
||||
w.h = 3
|
||||
}
|
||||
}
|
||||
|
||||
func (w *Cli) SetKeyMap(km KeyMap) { w.keyMap = km }
|
||||
@@ -174,8 +178,6 @@ func (w *Cli) Draw(screen tcell.Screen) {
|
||||
wh.DrawText(x, y, cursor, dStyle.Reverse(w.active), screen)
|
||||
x += 1
|
||||
wh.DrawText(x, y, wh.PadR(post, w.w-x-2), dStyle, screen)
|
||||
// wh.DrawText(w.x, y+1, fmt.Sprintf("Index: %d", w.historyPosition), dStyle, screen)
|
||||
// x += len(post) - 1
|
||||
}
|
||||
|
||||
func (w *Cli) Active() bool { return w.active }
|
||||
@@ -196,9 +198,15 @@ func (w *Cli) SetW(wd int) { w.w = wd }
|
||||
func (w *Cli) SetH(h int) { w.h = h }
|
||||
func (w *Cli) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
||||
func (w *Cli) WantW() int { return wh.MaxInt }
|
||||
func (w *Cli) WantH() int { return wh.MaxInt }
|
||||
func (w *Cli) MinW() int { return 20 }
|
||||
func (w *Cli) MinH() int { return 6 }
|
||||
func (w *Cli) WantH() int {
|
||||
if w.minimized {
|
||||
return 3
|
||||
} else {
|
||||
return wh.MaxInt
|
||||
}
|
||||
}
|
||||
func (w *Cli) MinW() int { return 20 }
|
||||
func (w *Cli) MinH() int { return 6 }
|
||||
|
||||
func (w *Cli) initKeyMap() {
|
||||
w.keyMap = NewKeyMap(map[tcell.Key]func(ev *tcell.EventKey) bool{
|
||||
@@ -341,6 +349,9 @@ func (w *Cli) Clear() {
|
||||
w.log = []string{}
|
||||
}
|
||||
|
||||
func (w *Cli) SetMinimized(m bool) { w.minimized = m }
|
||||
func (w *Cli) IsMinimized() bool { return w.minimized }
|
||||
|
||||
type cliCommand func(args ...string) bool
|
||||
|
||||
// TODO
|
||||
|
||||
Reference in New Issue
Block a user