aboutsummaryrefslogtreecommitdiff
path: root/widgets/msgviewer.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-30 16:50:14 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-30 16:50:14 -0400
commit4bdc0f37150db34eabbacef3c967a6643638265a (patch)
tree038855a715b1278b24940969ccd4b3d9f7223b87 /widgets/msgviewer.go
parentfd27a2baf6ecf5e534560e4ed79b3f1c1f1f6b3f (diff)
Minor refactoring to header view
Diffstat (limited to 'widgets/msgviewer.go')
-rw-r--r--widgets/msgviewer.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index a4fec09..ecfac3b 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -206,16 +206,21 @@ type HeaderView struct {
func (hv *HeaderView) Draw(ctx *ui.Context) {
size := runewidth.StringWidth(hv.Name)
- var style tcell.Style
+ var (
+ hstyle tcell.Style
+ vstyle tcell.Style
+ )
+ // TODO: Make this more robust and less dumb
if hv.Name == "PGP" {
- style = tcell.StyleDefault.Foreground(tcell.ColorGreen)
+ vstyle = tcell.StyleDefault.Foreground(tcell.ColorGreen)
+ hstyle = tcell.StyleDefault.Bold(true)
} else {
- style = tcell.StyleDefault
+ vstyle = tcell.StyleDefault
+ hstyle = tcell.StyleDefault.Bold(true)
}
- ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', style)
- ctx.Printf(0, 0,
- tcell.StyleDefault.Bold(true), hv.Name)
- ctx.Printf(size, 0, style, " "+hv.Value)
+ ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', vstyle)
+ ctx.Printf(0, 0, hstyle, hv.Name)
+ ctx.Printf(size, 0, vstyle, " "+hv.Value)
}
func (hv *HeaderView) Invalidate() {