diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2022-07-31 09:41:21 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-08-01 10:37:42 +0200 |
commit | 894668aec26502f0f17b4afff7aa7fc476710a2f (patch) | |
tree | 7b7768ea9e9327f422e300b09891d934ce8b5f9f | |
parent | 56dabb5c9cd769d0bbb3c37ba514da150eeb5943 (diff) | |
download | aerc-894668aec26502f0f17b4afff7aa7fc476710a2f.tar.gz |
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>
-rw-r--r-- | commands/msg/archive.go | 6 | ||||
-rw-r--r-- | commands/msg/move.go | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/commands/msg/archive.go b/commands/msg/archive.go index e1ff9a61..c4f06a3b 100644 --- a/commands/msg/archive.go +++ b/commands/msg/archive.go @@ -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] { diff --git a/commands/msg/move.go b/commands/msg/move.go index d88a36f1..b42a9847 100644 --- a/commands/msg/move.go +++ b/commands/msg/move.go @@ -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) { |