archive,move: fix reselect next message

Move and Archive used store.Next to select the next message. When moving
or archiving multiple messages with an upward movement, this would
result in a to-be-removed message being selected. Use findNextNonDeleted
function to select the correct next message for these commands.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Tim Culverhouse 2022-07-31 09:41:21 -05:00 committed by Robin Jarry
parent 56dabb5c9c
commit 894668aec2
2 changed files with 6 additions and 2 deletions

View File

@ -53,9 +53,13 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
return err
}
archiveDir := acct.AccountConfig().Archive
store.Next()
var uids []uint32
for _, msg := range msgs {
uids = append(uids, msg.Uid)
}
store.ClearVisualMark()
acct.Messages().Invalidate()
findNextNonDeleted(uids, store)
var uidMap map[string][]uint32
switch args[1] {

View File

@ -61,9 +61,9 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
if isMsgView {
aerc.RemoveTab(h.msgProvider)
}
store.Next()
store.ClearVisualMark()
acct.Messages().Invalidate()
findNextNonDeleted(uids, store)
joinedArgs := strings.Join(args[optind:], " ")
store.Move(uids, joinedArgs, createParents, func(
msg types.WorkerMessage) {