summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-04-16 10:18:00 -0500
committerSean E. Russell <ser@ser1.net>2020-04-16 10:18:00 -0500
commitd22c36e7195b80c199c25a7a0ed2525555e1de00 (patch)
tree240991a7c203f3d3eaa8444f412dc75bff56a931
parent193b40f30ecb949caa75285a3d86cef0d44fb177 (diff)
Fix #47, help & statusbar don't obey theme. Also fix help text layout.
-rw-r--r--widgets/help.go7
-rw-r--r--widgets/statusbar.go6
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),