store: extract marking behavior and add tests

Separate the marking functions from the message store and extract the
marking behavior into its own class with tests.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Koni Marti 2022-08-08 22:21:41 +02:00 committed by Robin Jarry
parent ee961d3b1d
commit cfc19a7ec2
14 changed files with 373 additions and 177 deletions
commands/msg

View file

@ -54,7 +54,8 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
if isMsgView {
aerc.RemoveTab(h.msgProvider)
}
store.ClearVisualMark()
marker := store.Marker()
marker.ClearVisualMark()
findNextNonDeleted(uids, store)
joinedArgs := strings.Join(args[optind:], " ")
store.Move(uids, joinedArgs, createParents, func(
@ -64,7 +65,7 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
case *types.Done:
aerc.PushStatus("Message moved to "+joinedArgs, 10*time.Second)
case *types.Error:
store.Remark()
marker.Remark()
aerc.PushError(msg.Error.Error())
}
})