aboutsummaryrefslogtreecommitdiff
path: root/commands/msg
diff options
context:
space:
mode:
Diffstat (limited to 'commands/msg')
-rw-r--r--commands/msg/delete.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index 55d7f68..06cef9c 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -43,11 +43,18 @@ func (_ Delete) Execute(aerc *widgets.Aerc, args []string) error {
return err
}
_, isMsgView := widget.(*widgets.MessageViewer)
+ mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
+ store.Next()
if isMsgView {
- aerc.RemoveTab(widget)
+ nextMsg := store.Selected()
+ if nextMsg == msg {
+ aerc.RemoveTab(widget)
+ acct.Messages().Scroll()
+ } else {
+ nextMv := widgets.NewMessageViewer(acct, aerc.Config(), store, nextMsg)
+ aerc.ReplaceTab(mv, nextMv, nextMsg.Envelope.Subject)
+ }
}
- store.Next()
- acct.Messages().Scroll()
store.Delete([]uint32{msg.Uid}, func(msg types.WorkerMessage) {
switch msg := msg.(type) {
case *types.Done: