aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/msgviewer.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-12-21 17:01:37 -0600
committerMoritz Poldrack <git@moritz.sh>2022-12-25 18:11:08 +0100
commit6b8e0b19d35a4aa3e1d300f4d25a463755589c6e (patch)
tree73bc22b6b7b349694ab7b3a145f83a24122533f2 /widgets/msgviewer.go
parenta4d7b5fc96bc2b28a18400f127b710464a143067 (diff)
downloadaerc-6b8e0b19d35a4aa3e1d300f4d25a463755589c6e.tar.gz
split: refactor to prevent stuck splits
Refactor split logic (again...) to prevent stuck splits. Use callback from msgstore.Select to tell the split which message to display. This keeps the account from having to track displayed messages, which prevents race conditions in certain situations. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to 'widgets/msgviewer.go')
-rw-r--r--widgets/msgviewer.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 0c72fa79..29ad0a83 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -48,6 +48,12 @@ type PartSwitcher struct {
func NewMessageViewer(
acct *AccountView, msg lib.MessageView,
) *MessageViewer {
+ if msg == nil {
+ return &MessageViewer{
+ acct: acct,
+ err: fmt.Errorf("(no message selected)"),
+ }
+ }
hf := HeaderLayoutFilter{
layout: HeaderLayout(config.Viewer.HeaderLayout),
keep: func(msg *models.MessageInfo, header string) bool {