aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2023-09-25 09:07:43 -0500
committerRobin Jarry <robin@jarry.cc>2023-09-27 23:12:41 +0200
commit4ec1e1a5e4c74236a6d1992c8778c39fd25d847b (patch)
treeb6ade84273558cf6c03ae8e7b606c3d2edd998ab /lib
parent439204d994e8ba9ab3045139bc716bee812f4029 (diff)
downloadaerc-4ec1e1a5e4c74236a6d1992c8778c39fd25d847b.tar.gz
ui: enable showing of thread-context
Add a UI config value to enable showing of "thread-context", similar to `notmuch show --entire-thread=true`. Add an associated style called "msglist_thread_context" which can be used to style such messages. Currently this feature is only supported by notmuch. It would be possible for maildir to implement as well, IMAP with gmail custom extensions, and JMAP. This patch merely implements the notmuch version and puts the groundwork in for handling these sorts of displays. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib')
-rw-r--r--lib/msgstore.go4
-rw-r--r--lib/state/templates.go10
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 01b78289..6186b195 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -49,6 +49,7 @@ type MessageStore struct {
threadedView bool
reverseThreadOrder bool
+ threadContext bool
sortThreadSiblings bool
buildThreads bool
builder *ThreadBuilder
@@ -87,6 +88,7 @@ func NewMessageStore(worker *types.Worker,
reverseOrder bool, reverseThreadOrder bool, sortThreadSiblings bool,
triggerNewEmail func(*models.MessageInfo),
triggerDirectoryChange func(), onSelect func(*models.MessageInfo),
+ threadContext bool,
) *MessageStore {
if !worker.Backend.Capabilities().Thread {
clientThreads = true
@@ -104,6 +106,7 @@ func NewMessageStore(worker *types.Worker,
threadedView: thread,
buildThreads: clientThreads,
+ threadContext: threadContext,
reverseThreadOrder: reverseThreadOrder,
sortThreadSiblings: sortThreadSiblings,
@@ -831,6 +834,7 @@ func (store *MessageStore) Sort(criteria []*types.SortCriterion, cb func(types.W
Context: store.ctx,
SortCriteria: criteria,
FilterCriteria: store.filter,
+ ThreadContext: store.threadContext,
}, handle_return)
} else {
store.worker.PostAction(&types.FetchDirectoryContents{
diff --git a/lib/state/templates.go b/lib/state/templates.go
index fbe5aa4a..88c5eeae 100644
--- a/lib/state/templates.go
+++ b/lib/state/templates.go
@@ -20,7 +20,7 @@ type DataSetter interface {
Data() models.TemplateData
SetHeaders(*mail.Header, *models.OriginalMail)
SetInfo(*models.MessageInfo, int, bool)
- SetThreading(string, bool, int, bool)
+ SetThreading(string, bool, int, bool, bool)
SetComposer(Composer)
SetAccount(*config.AccountConfig)
SetFolder(*models.Directory)
@@ -34,6 +34,7 @@ type ThreadInfo struct {
Prefix string
Count int
Folded bool
+ Context bool
}
type templateData struct {
@@ -86,12 +87,13 @@ func (d *templateData) SetInfo(info *models.MessageInfo, num int, marked bool,
}
func (d *templateData) SetThreading(prefix string, same bool, count int,
- folded bool,
+ folded bool, context bool,
) {
d.threadInfo.Prefix = prefix
d.threadInfo.SameSubject = same
d.threadInfo.Count = count
d.threadInfo.Folded = folded
+ d.threadInfo.Context = context
}
func (d *templateData) SetAccount(acct *config.AccountConfig) {
@@ -300,6 +302,10 @@ func (d *templateData) ThreadFolded() bool {
return d.threadInfo.Folded
}
+func (d *templateData) ThreadContext() bool {
+ return d.threadInfo.Context
+}
+
func (d *templateData) Subject() string {
var subject string
switch {