From d22c36e7195b80c199c25a7a0ed2525555e1de00 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" Date: Thu, 16 Apr 2020 10:18:00 -0500 Subject: Fix #47, help & statusbar don't obey theme. Also fix help text layout. --- widgets/help.go | 7 ++++++- widgets/statusbar.go | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/widgets/help.go b/widgets/help.go index 9f78dd0..8aab35d 100644 --- a/widgets/help.go +++ b/widgets/help.go @@ -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), ) } diff --git a/widgets/statusbar.go b/widgets/statusbar.go index f610081..efa3dbf 100644 --- a/widgets/statusbar.go +++ b/widgets/statusbar.go @@ -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), -- cgit v1.2.3