diff options
author | Drew DeVault <sir@cmpwn.com> | 2020-05-28 10:32:42 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-05-28 10:32:42 -0400 |
commit | caad1b2c06a0446059ee5ee916e3dce1794b159b (patch) | |
tree | ee81255485234137a5902d87d5960ac06618b341 /widgets/status.go | |
parent | 76a91813d8dc0f0011202f8120fc197097f022aa (diff) | |
download | aerc-caad1b2c06a0446059ee5ee916e3dce1794b159b.tar.gz |
Revert "Add Style configuration"
This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
Diffstat (limited to 'widgets/status.go')
-rw-r--r-- | widgets/status.go | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/widgets/status.go b/widgets/status.go index d6d7761b..8d0a1aec 100644 --- a/widgets/status.go +++ b/widgets/status.go @@ -6,7 +6,6 @@ import ( "github.com/gdamore/tcell" "github.com/mattn/go-runewidth" - "git.sr.ht/~sircmpwn/aerc/config" "git.sr.ht/~sircmpwn/aerc/lib/ui" ) @@ -15,21 +14,21 @@ type StatusLine struct { stack []*StatusMessage fallback StatusMessage aerc *Aerc - uiConfig config.UIConfig } type StatusMessage struct { - style tcell.Style + bg tcell.Color + fg tcell.Color message string } -func NewStatusLine(uiConfig config.UIConfig) *StatusLine { +func NewStatusLine() *StatusLine { return &StatusLine{ fallback: StatusMessage{ - style: uiConfig.GetStyle(config.STYLE_STATUSLINE_DEFAULT), + bg: tcell.ColorDefault, + fg: tcell.ColorDefault, message: "Idle", }, - uiConfig: uiConfig, } } @@ -42,7 +41,9 @@ func (status *StatusLine) Draw(ctx *ui.Context) { if len(status.stack) != 0 { line = status.stack[len(status.stack)-1] } - ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', line.style) + style := tcell.StyleDefault. + Background(line.bg).Foreground(line.fg).Reverse(true) + ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', style) pendingKeys := "" if status.aerc != nil { for _, pendingKey := range status.aerc.pendingKeys { @@ -50,21 +51,13 @@ func (status *StatusLine) Draw(ctx *ui.Context) { } } message := runewidth.FillRight(line.message, ctx.Width()-len(pendingKeys)-5) - ctx.Printf(0, 0, line.style, "%s%s", message, pendingKeys) + ctx.Printf(0, 0, style, "%s%s", message, pendingKeys) } func (status *StatusLine) Set(text string) *StatusMessage { status.fallback = StatusMessage{ - style: status.uiConfig.GetStyle(config.STYLE_STATUSLINE_DEFAULT), - message: text, - } - status.Invalidate() - return &status.fallback -} - -func (status *StatusLine) SetError(text string) *StatusMessage { - status.fallback = StatusMessage{ - style: status.uiConfig.GetStyle(config.STYLE_STATUSLINE_ERROR), + bg: tcell.ColorDefault, + fg: tcell.ColorDefault, message: text, } status.Invalidate() @@ -73,7 +66,8 @@ func (status *StatusLine) SetError(text string) *StatusMessage { func (status *StatusLine) Push(text string, expiry time.Duration) *StatusMessage { msg := &StatusMessage{ - style: status.uiConfig.GetStyle(config.STYLE_STATUSLINE_DEFAULT), + bg: tcell.ColorDefault, + fg: tcell.ColorDefault, message: text, } status.stack = append(status.stack, msg) @@ -90,18 +84,6 @@ func (status *StatusLine) Push(text string, expiry time.Duration) *StatusMessage return msg } -func (status *StatusLine) PushError(text string, expiry time.Duration) *StatusMessage { - msg := status.Push(text, expiry) - msg.Color(status.uiConfig.GetStyle(config.STYLE_STATUSLINE_ERROR)) - return msg -} - -func (status *StatusLine) PushSuccess(text string, expiry time.Duration) *StatusMessage { - msg := status.Push(text, expiry) - msg.Color(status.uiConfig.GetStyle(config.STYLE_STATUSLINE_SUCCESS)) - return msg -} - func (status *StatusLine) Expire() { status.stack = nil } @@ -110,6 +92,7 @@ func (status *StatusLine) SetAerc(aerc *Aerc) { status.aerc = aerc } -func (msg *StatusMessage) Color(style tcell.Style) { - msg.style = style +func (msg *StatusMessage) Color(bg tcell.Color, fg tcell.Color) { + msg.bg = bg + msg.fg = fg } |