align ctop header on resize, add keybinding to help dialog

This commit is contained in:
Bradley Cicenas
2017-02-19 23:52:59 +00:00
parent 335ac8d741
commit 93db38d654
3 changed files with 10 additions and 3 deletions

View File

@@ -17,8 +17,8 @@ type CTopHeader struct {
func NewCTopHeader() *CTopHeader {
return &CTopHeader{
Time: headerPar(2, timeStr()),
Count: headerPar(22, "-"),
Filter: headerPar(42, ""),
Count: headerPar(27, "-"),
Filter: headerPar(47, ""),
bg: headerBg(),
}
}
@@ -29,6 +29,10 @@ func (c *CTopHeader) Render() {
ui.Render(c.Time, c.Count, c.Filter)
}
func (c *CTopHeader) Align() {
c.bg.SetWidth(ui.TermWidth() - 1)
}
func (c *CTopHeader) Height() int {
return c.bg.Height
}
@@ -65,7 +69,8 @@ func (c *CTopHeader) SetFilter(val string) {
}
func timeStr() string {
return time.Now().Local().Format("15:04:05 MST")
ts := time.Now().Local().Format("15:04:05 MST")
return fmt.Sprintf("cTop - %s", ts)
}
func headerPar(x int, s string) *ui.Par {