aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-21 21:34:12 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-21 21:34:12 -0400
commite59122150932ae2cad32ab5881ed40ef0d722812 (patch)
tree036d3bc807bc6bbad4bda301c6de6d5897f9f976 /widgets
parenta602891768d0272c8688731752f491eb92668d7d (diff)
downloadaerc-e59122150932ae2cad32ab5881ed40ef0d722812.tar.gz
Expire status errors on input
Diffstat (limited to 'widgets')
-rw-r--r--widgets/aerc.go9
-rw-r--r--widgets/status.go4
-rw-r--r--widgets/terminal.go14
3 files changed, 21 insertions, 6 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index bdf94bd3..92fc06ef 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -124,6 +124,7 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
switch event := event.(type) {
case *tcell.EventKey:
+ aerc.statusline.Expire()
aerc.pendingKeys = append(aerc.pendingKeys, config.KeyStroke{
Key: event.Key(),
Rune: event.Rune(),
@@ -231,8 +232,16 @@ func (aerc *Aerc) focus(item libui.Interactive) {
aerc.focused.Focus(false)
}
aerc.focused = item
+ interactive, ok := aerc.tabs.Tabs[aerc.tabs.Selected].Content.(ui.Interactive)
if item != nil {
item.Focus(true)
+ if ok {
+ interactive.Focus(false)
+ }
+ } else {
+ if ok {
+ interactive.Focus(true)
+ }
}
}
diff --git a/widgets/status.go b/widgets/status.go
index b7d94904..7a746fae 100644
--- a/widgets/status.go
+++ b/widgets/status.go
@@ -81,6 +81,10 @@ func (status *StatusLine) Push(text string, expiry time.Duration) *StatusMessage
return msg
}
+func (status *StatusLine) Expire() {
+ status.stack = nil
+}
+
func (msg *StatusMessage) Color(bg tcell.Color, fg tcell.Color) {
msg.bg = bg
msg.fg = fg
diff --git a/widgets/terminal.go b/widgets/terminal.go
index 4a339cc4..e7286f96 100644
--- a/widgets/terminal.go
+++ b/widgets/terminal.go
@@ -310,12 +310,14 @@ func (term *Terminal) Draw(ctx *ui.Context) {
func (term *Terminal) Focus(focus bool) {
term.focus = focus
- if !term.focus {
- term.ctx.HideCursor()
- } else {
- state := term.vterm.ObtainState()
- row, col := state.GetCursorPos()
- term.ctx.SetCursor(col, row)
+ if term.ctx != nil {
+ if !term.focus {
+ term.ctx.HideCursor()
+ } else {
+ state := term.vterm.ObtainState()
+ row, col := state.GetCursorPos()
+ term.ctx.SetCursor(col, row)
+ }
}
}