summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--commands/account/mkdir.go5
-rw-r--r--commands/compose/send.go3
-rw-r--r--commands/exec.go3
-rw-r--r--commands/msg/archive.go5
-rw-r--r--commands/msg/copy.go4
-rw-r--r--commands/msg/delete.go5
-rw-r--r--commands/msg/modify-labels.go4
-rw-r--r--commands/msg/move.go4
-rw-r--r--commands/msg/pipe.go3
-rw-r--r--commands/msg/read.go8
-rw-r--r--commands/term.go9
-rw-r--r--widgets/account-wizard.go10
-rw-r--r--widgets/aerc.go9
13 files changed, 20 insertions, 52 deletions
diff --git a/commands/account/mkdir.go b/commands/account/mkdir.go
index bb7e38a..9d16063 100644
--- a/commands/account/mkdir.go
+++ b/commands/account/mkdir.go
@@ -5,8 +5,6 @@ import (
 	"strings"
 	"time"
 
-	"github.com/gdamore/tcell"
-
 	"git.sr.ht/~sircmpwn/aerc/widgets"
 	"git.sr.ht/~sircmpwn/aerc/worker/types"
 )
@@ -42,8 +40,7 @@ func (MakeDir) Execute(aerc *widgets.Aerc, args []string) error {
 			aerc.PushStatus("Directory created.", 10*time.Second)
 			acct.Directories().Select(name)
 		case *types.Error:
-			aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+msg.Error.Error())
 		}
 	})
 	return nil
diff --git a/commands/compose/send.go b/commands/compose/send.go
index c8f7cc5..f726a60 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -246,8 +246,7 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
 					r.Close()
 					composer.Close()
 				case *types.Error:
-					aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second).
-						Color(tcell.ColorDefault, tcell.ColorRed)
+					aerc.PushError(" "+msg.Error.Error())
 					r.Close()
 					composer.Close()
 				}
diff --git a/commands/exec.go b/commands/exec.go
index f615b71..e90652d 100644
--- a/commands/exec.go
+++ b/commands/exec.go
@@ -33,8 +33,7 @@ func (ExecCmd) Execute(aerc *widgets.Aerc, args []string) error {
 	go func() {
 		err := cmd.Run()
 		if err != nil {
-			aerc.PushStatus(" "+err.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+err.Error())
 		} else {
 			color := tcell.ColorDefault
 			if cmd.ProcessState.ExitCode() != 0 {
diff --git a/commands/msg/archive.go b/commands/msg/archive.go
index 783ab04..b7a14e7 100644
--- a/commands/msg/archive.go
+++ b/commands/msg/archive.go
@@ -7,8 +7,6 @@ import (
 	"sync"
 	"time"
 
-	"github.com/gdamore/tcell"
-
 	"git.sr.ht/~sircmpwn/aerc/commands"
 	"git.sr.ht/~sircmpwn/aerc/models"
 	"git.sr.ht/~sircmpwn/aerc/widgets"
@@ -88,8 +86,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
 			case *types.Done:
 				wg.Done()
 			case *types.Error:
-				aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second).
-					Color(tcell.ColorDefault, tcell.ColorRed)
+				aerc.PushError(" "+msg.Error.Error())
 				success = false
 				wg.Done()
 			}
diff --git a/commands/msg/copy.go b/commands/msg/copy.go
index 30022f1..c2f79c6 100644
--- a/commands/msg/copy.go
+++ b/commands/msg/copy.go
@@ -6,7 +6,6 @@ import (
 	"time"
 
 	"git.sr.ht/~sircmpwn/getopt"
-	"github.com/gdamore/tcell"
 
 	"git.sr.ht/~sircmpwn/aerc/commands"
 	"git.sr.ht/~sircmpwn/aerc/widgets"
@@ -61,8 +60,7 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error {
 			case *types.Done:
 				aerc.PushStatus("Messages copied.", 10*time.Second)
 			case *types.Error:
-				aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second).
-					Color(tcell.ColorDefault, tcell.ColorRed)
+				aerc.PushError(" "+msg.Error.Error())
 			}
 		})
 	return nil
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index fb0d1f8..39a9cc5 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -4,8 +4,6 @@ import (
 	"errors"
 	"time"
 
-	"github.com/gdamore/tcell"
-
 	"git.sr.ht/~sircmpwn/aerc/lib"
 	"git.sr.ht/~sircmpwn/aerc/models"
 	"git.sr.ht/~sircmpwn/aerc/widgets"
@@ -49,8 +47,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
 		case *types.Done:
 			aerc.PushStatus("Messages deleted.", 10*time.Second)
 		case *types.Error:
-			aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+msg.Error.Error())
 		}
 	})
 
diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go
index a53292e..6fcd6ed 100644
--- a/commands/msg/modify-labels.go
+++ b/commands/msg/modify-labels.go
@@ -7,7 +7,6 @@ import (
 	"git.sr.ht/~sircmpwn/aerc/commands"
 	"git.sr.ht/~sircmpwn/aerc/widgets"
 	"git.sr.ht/~sircmpwn/aerc/worker/types"
-	"github.com/gdamore/tcell"
 )
 
 type ModifyLabels struct{}
@@ -59,8 +58,7 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error {
 		case *types.Done:
 			aerc.PushStatus("labels updated", 10*time.Second)
 		case *types.Error:
-			aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+msg.Error.Error())
 		}
 	})
 	return nil
diff --git a/commands/msg/move.go b/commands/msg/move.go
index 37402ef..182817e 100644
--- a/commands/msg/move.go
+++ b/commands/msg/move.go
@@ -6,7 +6,6 @@ import (
 	"time"
 
 	"git.sr.ht/~sircmpwn/getopt"
-	"github.com/gdamore/tcell"
 
 	"git.sr.ht/~sircmpwn/aerc/commands"
 	"git.sr.ht/~sircmpwn/aerc/widgets"
@@ -72,8 +71,7 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
 		case *types.Done:
 			aerc.PushStatus("Message moved to "+joinedArgs, 10*time.Second)
 		case *types.Error:
-			aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+msg.Error.Error())
 		}
 	})
 	return nil
diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go
index 9491cf5..136d533 100644
--- a/commands/msg/pipe.go
+++ b/commands/msg/pipe.go
@@ -93,8 +93,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error {
 		}()
 		err = ecmd.Run()
 		if err != nil {
-			aerc.PushStatus(" "+err.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+err.Error())
 		} else {
 			color := tcell.ColorDefault
 			if ecmd.ProcessState.ExitCode() != 0 {
diff --git a/commands/msg/read.go b/commands/msg/read.go
index ef07523..8613f3f 100644
--- a/commands/msg/read.go
+++ b/commands/msg/read.go
@@ -7,8 +7,6 @@ import (
 
 	"git.sr.ht/~sircmpwn/getopt"
 
-	"github.com/gdamore/tcell"
-
 	"git.sr.ht/~sircmpwn/aerc/lib"
 	"git.sr.ht/~sircmpwn/aerc/models"
 	"git.sr.ht/~sircmpwn/aerc/widgets"
@@ -95,8 +93,7 @@ func submitReadChange(aerc *widgets.Aerc, store *lib.MessageStore,
 		case *types.Done:
 			aerc.PushStatus(msg_success, 10*time.Second)
 		case *types.Error:
-			aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+msg.Error.Error())
 		}
 	})
 }
@@ -109,8 +106,7 @@ func submitReadChangeWg(aerc *widgets.Aerc, store *lib.MessageStore,
 		case *types.Done:
 			wg.Done()
 		case *types.Error:
-			aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+msg.Error.Error())
 			*success = false
 			wg.Done()
 		}
diff --git a/commands/term.go b/commands/term.go
index 459f405..c75fda5 100644
--- a/commands/term.go
+++ b/commands/term.go
@@ -2,12 +2,10 @@ package commands
 
 import (
 	"os/exec"
-	"time"
 
-	"git.sr.ht/~sircmpwn/aerc/widgets"
-
-	"github.com/gdamore/tcell"
 	"github.com/riywo/loginshell"
+
+	"git.sr.ht/~sircmpwn/aerc/widgets"
 )
 
 type Term struct{}
@@ -48,8 +46,7 @@ func TermCore(aerc *widgets.Aerc, args []string) error {
 	term.OnClose = func(err error) {
 		aerc.RemoveTab(term)
 		if err != nil {
-			aerc.PushStatus(" "+err.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+err.Error())
 		}
 	}
 	return nil
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index d7b46b9..e9bd843 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -10,7 +10,6 @@ import (
 	"path"
 	"strconv"
 	"strings"
-	"time"
 
 	"github.com/gdamore/tcell"
 	"github.com/go-ini/ini"
@@ -415,8 +414,7 @@ func (wizard *AccountWizard) ConfigureTemporaryAccount(temporary bool) {
 
 func (wizard *AccountWizard) errorFor(d ui.Interactive, err error) {
 	if d == nil {
-		wizard.aerc.PushStatus(" "+err.Error(), 10*time.Second).
-			Color(tcell.ColorDefault, tcell.ColorRed)
+		wizard.aerc.PushError(" "+err.Error())
 		wizard.Invalidate()
 		return
 	}
@@ -431,8 +429,7 @@ func (wizard *AccountWizard) errorFor(d ui.Interactive, err error) {
 				wizard.step = step
 				wizard.focus = focus
 				wizard.Focus(true)
-				wizard.aerc.PushStatus(" "+err.Error(), 10*time.Second).
-					Color(tcell.ColorDefault, tcell.ColorRed)
+				wizard.aerc.PushError(" "+err.Error())
 				wizard.Invalidate()
 				return
 			}
@@ -543,8 +540,7 @@ func (wizard *AccountWizard) finish(tutorial bool) {
 		term.OnClose = func(err error) {
 			wizard.aerc.RemoveTab(term)
 			if err != nil {
-				wizard.aerc.PushStatus(" "+err.Error(), 10*time.Second).
-					Color(tcell.ColorDefault, tcell.ColorRed)
+				wizard.aerc.PushError(" "+err.Error())
 			}
 		}
 	}
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 4c8d09d..1d45696 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -408,13 +408,11 @@ func (aerc *Aerc) BeginExCommand(cmd string) {
 	exline := NewExLine(aerc.conf, cmd, func(cmd string) {
 		parts, err := shlex.Split(cmd)
 		if err != nil {
-			aerc.PushStatus(" "+err.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+err.Error())
 		}
 		err = aerc.cmd(parts)
 		if err != nil {
-			aerc.PushStatus(" "+err.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+err.Error())
 		}
 		// only add to history if this is an unsimulated command,
 		// ie one not executed from a keybinding
@@ -438,8 +436,7 @@ func (aerc *Aerc) RegisterPrompt(prompt string, cmd []string) {
 		}
 		err := aerc.cmd(cmd)
 		if err != nil {
-			aerc.PushStatus(" "+err.Error(), 10*time.Second).
-				Color(tcell.ColorDefault, tcell.ColorRed)
+			aerc.PushError(" "+err.Error())
 		}
 	}, func(cmd string) []string {
 		return nil // TODO: completions