aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorJohannes Thyssen Tishman <johannes@thyssentishman.com>2024-01-27 15:13:11 +0100
committerRobin Jarry <robin@jarry.cc>2024-01-27 23:01:31 +0100
commit8e87435890fe74db654f3f4dbbeb7dee47ddf276 (patch)
tree9ae5ad4c6d91d626b47aee26dbaf24b85436c02b /commands
parent64d76e32d1d4db0f9512a71c2896253f23eb3c06 (diff)
downloadaerc-8e87435890fe74db654f3f4dbbeb7dee47ddf276.tar.gz
mv: fix regression in selection of next message
Commit 41c25caafd58 ("mv: allow to move messages across accounts") introduced a regression where moving a message causes the last message in the list to be selected instead of the next available one. Record the next message to jump to *before* actually jumping. Fixes: 41c25caafd58 ("mv: allow to move messages across accounts") Fixes: https://todo.sr.ht/~rjarry/aerc/219 Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands')
-rw-r--r--commands/msg/move.go21
1 files changed, 15 insertions, 6 deletions
diff --git a/commands/msg/move.go b/commands/msg/move.go
index defe94d1..704ca6e6 100644
--- a/commands/msg/move.go
+++ b/commands/msg/move.go
@@ -9,6 +9,7 @@ import (
"git.sr.ht/~rjarry/aerc/commands"
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib"
+ "git.sr.ht/~rjarry/aerc/lib/marker"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/models"
@@ -65,9 +66,13 @@ func (m Move) Execute(args []string) error {
return err
}
+ next := findNextNonDeleted(uids, store)
+ marker := store.Marker()
+ marker.ClearVisualMark()
+
if len(m.Account) == 0 {
store.Move(uids, m.Folder, m.CreateFolders, func(msg types.WorkerMessage) {
- m.CallBack(msg, acct, uids, false)
+ m.CallBack(msg, acct, uids, next, marker, false)
})
return nil
}
@@ -154,19 +159,23 @@ func (m Move) Execute(args []string) error {
}
if len(appended) > 0 {
store.Delete(appended, func(msg types.WorkerMessage) {
- m.CallBack(msg, acct, appended, timeout)
+ m.CallBack(msg, acct, appended, next, marker, timeout)
})
}
}()
return nil
}
-func (m Move) CallBack(msg types.WorkerMessage, acct *app.AccountView, uids []uint32, timeout bool) {
+func (m Move) CallBack(
+ msg types.WorkerMessage,
+ acct *app.AccountView,
+ uids []uint32,
+ next *models.MessageInfo,
+ marker marker.Marker,
+ timeout bool,
+) {
store := acct.Store()
sel := store.Selected()
- marker := store.Marker()
- marker.ClearVisualMark()
- next := findNextNonDeleted(uids, store)
dest := m.Folder
if len(m.Account) > 0 {