select next message when deleting from message viewer

This commit is contained in:
Aditya Srivastava 2019-08-01 08:27:03 -07:00 committed by Drew DeVault
parent c9a909fee3
commit b72bb27cb4
1 changed files with 11 additions and 4 deletions

View File

@ -43,11 +43,18 @@ func (_ Delete) Execute(aerc *widgets.Aerc, args []string) error {
return err
}
_, isMsgView := widget.(*widgets.MessageViewer)
if isMsgView {
aerc.RemoveTab(widget)
}
mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
store.Next()
acct.Messages().Scroll()
if isMsgView {
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.Delete([]uint32{msg.Uid}, func(msg types.WorkerMessage) {
switch msg := msg.(type) {
case *types.Done: