delete: select new last message if last message was deleted
If the last message is deleted, the new selection should be the last message instead of the first message. Fixes: https://todo.sr.ht/~rjarry/aerc/59 Reported-by: Sebastien Binet <s@sbinet.org> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
80f8bab6cf
commit
9bfcec5660
1 changed files with 7 additions and 0 deletions
|
@ -56,6 +56,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
// no more messages in the list
|
// no more messages in the list
|
||||||
if next == nil {
|
if next == nil {
|
||||||
aerc.RemoveTab(h.msgProvider)
|
aerc.RemoveTab(h.msgProvider)
|
||||||
|
store.Select(len(store.Uids()))
|
||||||
acct.Messages().Invalidate()
|
acct.Messages().Invalidate()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -69,6 +70,12 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
aerc.ReplaceTab(mv, nextMv, next.Envelope.Subject)
|
aerc.ReplaceTab(mv, nextMv, next.Envelope.Subject)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if next == nil {
|
||||||
|
// We deleted the last message, select the new last message
|
||||||
|
// instead of the first message
|
||||||
|
store.Select(len(store.Uids()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
acct.Messages().Invalidate()
|
acct.Messages().Invalidate()
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
|
|
Loading…
Reference in a new issue