Fix #47, help & statusbar don't obey theme. Also fix help text layout.
This commit is contained in:
parent
193b40f30e
commit
d22c36e719
@ -54,6 +54,11 @@ func NewHelpMenu() *HelpMenu {
|
||||
|
||||
func (self *HelpMenu) Resize(termWidth, termHeight int) {
|
||||
textWidth := 53
|
||||
for _, line := range strings.Split(KEYBINDS, "\n") {
|
||||
if textWidth < len(line) {
|
||||
textWidth = len(line) + 2
|
||||
}
|
||||
}
|
||||
textHeight := strings.Count(KEYBINDS, "\n") + 1
|
||||
x := (termWidth - textWidth) / 2
|
||||
y := (termHeight - textHeight) / 2
|
||||
@ -67,7 +72,7 @@ func (self *HelpMenu) Draw(buf *ui.Buffer) {
|
||||
for y, line := range strings.Split(KEYBINDS, "\n") {
|
||||
for x, rune := range line {
|
||||
buf.SetCell(
|
||||
ui.NewCell(rune, ui.NewStyle(7)),
|
||||
ui.NewCell(rune, ui.Theme.Default),
|
||||
image.Pt(self.Inner.Min.X+x, self.Inner.Min.Y+y-1),
|
||||
)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ func (self *StatusBar) Draw(buf *ui.Buffer) {
|
||||
}
|
||||
buf.SetString(
|
||||
hostname,
|
||||
ui.NewStyle(ui.ColorWhite),
|
||||
ui.Theme.Default,
|
||||
image.Pt(self.Inner.Min.X, self.Inner.Min.Y+(self.Inner.Dy()/2)),
|
||||
)
|
||||
|
||||
@ -37,7 +37,7 @@ func (self *StatusBar) Draw(buf *ui.Buffer) {
|
||||
formattedTime := currentTime.Format("15:04:05")
|
||||
buf.SetString(
|
||||
formattedTime,
|
||||
ui.NewStyle(ui.ColorWhite),
|
||||
ui.Theme.Default,
|
||||
image.Pt(
|
||||
self.Inner.Min.X+(self.Inner.Dx()/2)-len(formattedTime)/2,
|
||||
self.Inner.Min.Y+(self.Inner.Dy()/2),
|
||||
@ -46,7 +46,7 @@ func (self *StatusBar) Draw(buf *ui.Buffer) {
|
||||
|
||||
buf.SetString(
|
||||
"gotop",
|
||||
ui.NewStyle(ui.ColorWhite),
|
||||
ui.Theme.Default,
|
||||
image.Pt(
|
||||
self.Inner.Max.X-6,
|
||||
self.Inner.Min.Y+(self.Inner.Dy()/2),
|
||||
|
Loading…
x
Reference in New Issue
Block a user