aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/exec.go6
-rw-r--r--commands/msg/pipe.go8
-rw-r--r--lib/msgstore.go14
3 files changed, 24 insertions, 4 deletions
diff --git a/commands/exec.go b/commands/exec.go
index a46b93ab..27edf5d6 100644
--- a/commands/exec.go
+++ b/commands/exec.go
@@ -36,10 +36,14 @@ func (_ ExecCmd) Execute(aerc *widgets.Aerc, args []string) error {
aerc.PushStatus(" "+err.Error(), 10*time.Second).
Color(tcell.ColorDefault, tcell.ColorRed)
} else {
+ color := tcell.ColorDefault
+ if cmd.ProcessState.ExitCode() != 0 {
+ color = tcell.ColorRed
+ }
aerc.PushStatus(fmt.Sprintf(
"%s: completed with status %d", args[0],
cmd.ProcessState.ExitCode()), 10*time.Second).
- Color(tcell.ColorDefault, tcell.ColorDefault)
+ Color(tcell.ColorDefault, color)
}
}()
return nil
diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go
index 158f9ea3..6f8c6167 100644
--- a/commands/msg/pipe.go
+++ b/commands/msg/pipe.go
@@ -91,10 +91,14 @@ func (_ Pipe) Execute(aerc *widgets.Aerc, args []string) error {
aerc.PushStatus(" "+err.Error(), 10*time.Second).
Color(tcell.ColorDefault, tcell.ColorRed)
} else {
+ color := tcell.ColorDefault
+ if ecmd.ProcessState.ExitCode() != 0 {
+ color = tcell.ColorRed
+ }
aerc.PushStatus(fmt.Sprintf(
- "%s: completed with status %d", args[0],
+ "%s: completed with status %d", cmd[0],
ecmd.ProcessState.ExitCode()), 10*time.Second).
- Color(tcell.ColorDefault, tcell.ColorDefault)
+ Color(tcell.ColorDefault, color)
}
}
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 595908d6..038c3cac 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -92,7 +92,18 @@ func (store *MessageStore) FetchFull(uids []uint32, cb func(io.Reader)) {
}
}
if len(toFetch) > 0 {
- store.worker.PostAction(&types.FetchFullMessages{Uids: toFetch}, nil)
+ store.worker.PostAction(&types.FetchFullMessages{
+ Uids: toFetch,
+ }, func(msg types.WorkerMessage) {
+ switch msg.(type) {
+ case *types.Error:
+ for _, uid := range toFetch {
+ if _, ok := store.bodyCallbacks[uid]; ok {
+ delete(store.bodyCallbacks, uid)
+ }
+ }
+ }
+ })
}
}
@@ -169,6 +180,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
for _, cb := range cbs {
cb(msg.Content.Reader)
}
+ delete(store.bodyCallbacks, msg.Content.Uid)
}
}
case *types.MessagesDeleted: