Change MarkedMessages to return uids
Especially if one tries to interact with all marked messages there could be the case that not all headers are fetched yet, hence the messageInfo is still nil. This segfaults a lot of commands which in principle only need the uid to complete. If we switch to uids, this issue can be alleviated for those commands.
This commit is contained in:
parent
381c1fc05f
commit
ea2646fc03
5 changed files with 30 additions and 14 deletions
commands/msg
|
@ -18,12 +18,7 @@ func newHelper(aerc *widgets.Aerc) *helper {
|
|||
}
|
||||
|
||||
func (h *helper) markedOrSelectedUids() ([]uint32, error) {
|
||||
msgs, err := commands.MarkedOrSelected(h.msgProvider)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uids := commands.UidsFromMessageInfos(msgs)
|
||||
return uids, nil
|
||||
return commands.MarkedOrSelected(h.msgProvider)
|
||||
}
|
||||
|
||||
func (h *helper) store() (*lib.MessageStore, error) {
|
||||
|
@ -43,5 +38,13 @@ func (h *helper) account() (*widgets.AccountView, error) {
|
|||
}
|
||||
|
||||
func (h *helper) messages() ([]*models.MessageInfo, error) {
|
||||
return commands.MarkedOrSelected(h.msgProvider)
|
||||
uid, err := commands.MarkedOrSelected(h.msgProvider)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
store, err := h.store()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return commands.MsgInfoFromUids(store, uid)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue