From b72bb27cb45f25d1df0d93be17474d8a08715411 Mon Sep 17 00:00:00 2001 From: Aditya Srivastava Date: Thu, 1 Aug 2019 08:27:03 -0700 Subject: select next message when deleting from message viewer --- commands/msg/delete.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'commands/msg') 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: -- cgit 1.4.1-2-gfad0