diff options
author | Koni Marti <koni.marti@gmail.com> | 2022-08-08 22:21:41 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-08-22 09:30:37 +0200 |
commit | cfc19a7ec22a1c60f79427ddbabdf437705efbab (patch) | |
tree | fbc4d54f9edb082ff87c84f864df17514c8e34da /widgets/account.go | |
parent | ee961d3b1d5ef412b3daf0ef0b8c18ac8957b365 (diff) | |
download | aerc-cfc19a7ec22a1c60f79427ddbabdf437705efbab.tar.gz |
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>
Diffstat (limited to 'widgets/account.go')
-rw-r--r-- | widgets/account.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/widgets/account.go b/widgets/account.go index ceb8d98e..b92a619d 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -9,6 +9,7 @@ import ( "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/sort" "git.sr.ht/~rjarry/aerc/lib/statusline" "git.sr.ht/~rjarry/aerc/lib/ui" @@ -222,8 +223,10 @@ func (acct *AccountView) SelectedMessage() (*models.MessageInfo, error) { } func (acct *AccountView) MarkedMessages() ([]uint32, error) { - store := acct.Store() - return store.Marked(), nil + if store := acct.Store(); store != nil { + return store.Marker().Marked(), nil + } + return nil, errors.New("no store available") } func (acct *AccountView) SelectedMessagePart() *PartInfo { @@ -301,6 +304,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { acct.host.Beep() } }) + store.SetMarker(marker.New(store)) acct.dirlist.SetMsgStore(msg.Info.Name, store) } case *types.DirectoryContents: |