msgview: enable next/prev with unfetched headers
Fix message view behavior for unfetched headers. When scrolling "over" the message list boundary, current behavior is to close the message viewer tab. Now, the headers will be fetched so that we can scroll through the messages uninterrupted. Fixes: https://todo.sr.ht/~rjarry/aerc/90 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
bd8a4feecc
commit
c6463ba481
1 changed files with 26 additions and 14 deletions
|
@ -5,7 +5,9 @@ import (
|
||||||
|
|
||||||
"git.sr.ht/~rjarry/aerc/commands/account"
|
"git.sr.ht/~rjarry/aerc/commands/account"
|
||||||
"git.sr.ht/~rjarry/aerc/lib"
|
"git.sr.ht/~rjarry/aerc/lib"
|
||||||
|
"git.sr.ht/~rjarry/aerc/models"
|
||||||
"git.sr.ht/~rjarry/aerc/widgets"
|
"git.sr.ht/~rjarry/aerc/widgets"
|
||||||
|
"git.sr.ht/~rjarry/aerc/worker/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NextPrevMsg struct{}
|
type NextPrevMsg struct{}
|
||||||
|
@ -37,20 +39,30 @@ func (NextPrevMsg) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
nextMsg := store.Selected()
|
executeNextPrev := func(nextMsg *models.MessageInfo) {
|
||||||
if nextMsg == nil {
|
lib.NewMessageStoreView(nextMsg, mv.MessageView().SeenFlagSet(),
|
||||||
aerc.RemoveTab(mv)
|
store, aerc.Crypto, aerc.DecryptKeys,
|
||||||
return nil
|
func(view lib.MessageView, err error) {
|
||||||
|
if err != nil {
|
||||||
|
aerc.PushError(err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
nextMv := widgets.NewMessageViewer(acct,
|
||||||
|
aerc.Config(), view)
|
||||||
|
aerc.ReplaceTab(mv, nextMv,
|
||||||
|
nextMsg.Envelope.Subject)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
lib.NewMessageStoreView(nextMsg, mv.MessageView().SeenFlagSet(),
|
if nextMsg := store.Selected(); nextMsg != nil {
|
||||||
store, aerc.Crypto, aerc.DecryptKeys,
|
executeNextPrev(nextMsg)
|
||||||
func(view lib.MessageView, err error) {
|
} else {
|
||||||
if err != nil {
|
store.FetchHeaders([]uint32{store.SelectedUid()},
|
||||||
aerc.PushError(err.Error())
|
func(msg types.WorkerMessage) {
|
||||||
return
|
if m, ok := msg.(*types.MessageInfo); ok {
|
||||||
}
|
executeNextPrev(m.Info)
|
||||||
nextMv := widgets.NewMessageViewer(acct, aerc.Config(), view)
|
}
|
||||||
aerc.ReplaceTab(mv, nextMv, nextMsg.Envelope.Subject)
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue