aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulio B <julio.bacel@gmail.com>2024-03-06 01:11:05 +0200
committerRobin Jarry <robin@jarry.cc>2024-04-13 21:46:32 +0200
commit941e2e9e7de058f9e6e10efab1ece8be4188468e (patch)
tree85907c9c23171768c9ba9c41d42f8e802ece3039
parent672b4edca7af2303cfcb1d69a676556d12476b5f (diff)
downloadaerc-941e2e9e7de058f9e6e10efab1ece8be4188468e.tar.gz
aerc-941e2e9e7de058f9e6e10efab1ece8be4188468e.zip
ui: use a custom prefix for dummy root
These messages are not really the root of the thread, and should not be displayed as such. Add a new special prefix to make them appear like the first child of a rootless thread. Signed-off-by: Julio B <julio.bacel@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--app/msglist.go6
-rw-r--r--config/aerc.conf14
-rw-r--r--config/ui.go2
-rw-r--r--doc/aerc-config.5.scd11
-rw-r--r--worker/notmuch/lib/database.go1
-rw-r--r--worker/types/thread.go3
6 files changed, 36 insertions, 1 deletions
diff --git a/app/msglist.go b/app/msglist.go
index 4cdf614a..996ffa0c 100644
--- a/app/msglist.go
+++ b/app/msglist.go
@@ -438,7 +438,7 @@ func unreadInThread(thread *types.Thread, store *lib.MessageStore) (ctr int) {
func threadPrefix(t *types.Thread, reverse bool, msglist bool) string {
uiConfig := SelectedAccountUiConfig()
- var tip, prefix, firstChild, lastSibling, orphan string
+ var tip, prefix, firstChild, lastSibling, orphan, dummy string
if msglist {
tip = uiConfig.ThreadPrefixTip
} else {
@@ -472,10 +472,12 @@ func threadPrefix(t *types.Thread, reverse bool, msglist bool) string {
firstChild = uiConfig.ThreadPrefixFirstChildReverse
lastSibling = uiConfig.ThreadPrefixLastSiblingReverse
orphan = uiConfig.ThreadPrefixOrphanReverse
+ dummy = uiConfig.ThreadPrefixDummyReverse
} else {
firstChild = uiConfig.ThreadPrefixFirstChild
lastSibling = uiConfig.ThreadPrefixLastSibling
orphan = uiConfig.ThreadPrefixOrphan
+ dummy = uiConfig.ThreadPrefixDummy
}
var hiddenOffspring bool = t.FirstChild != nil && t.FirstChild.Hidden > 0
@@ -503,6 +505,8 @@ func threadPrefix(t *types.Thread, reverse bool, msglist bool) string {
uiConfig.ThreadPrefixTip
case t.Parent == nil && hiddenOffspring:
prefix = uiConfig.ThreadPrefixFolded
+ case t.Parent == nil && t.Dummy:
+ prefix = dummy + tip
case t.Parent == nil && t.FirstChild != nil:
prefix = orphan
case t.Parent == nil && t.FirstChild == nil:
diff --git a/config/aerc.conf b/config/aerc.conf
index 17b9d216..a6f287a1 100644
--- a/config/aerc.conf
+++ b/config/aerc.conf
@@ -478,6 +478,20 @@
#thread-prefix-last-sibling-reverse = "┌─"
#
+# Customize the thread prefix appearance by selecting the connector for dummy
+# thread.
+#
+# Default: "┬─"
+#thread-prefix-dummy = "┬─"
+
+#
+# Customize the reversed thread prefix appearance by selecting the connector for
+# dummy thread.
+#
+# Default: "┴─"
+#thread-prefix-dummy-reverse = "┴─"
+
+#
# Customize the reversed thread prefix appearance by selecting the first child
# connector.
#
diff --git a/config/ui.go b/config/ui.go
index 7b819192..7da365d6 100644
--- a/config/ui.go
+++ b/config/ui.go
@@ -95,9 +95,11 @@ type UIConfig struct {
ThreadPrefixLone string `ini:"thread-prefix-lone" default:""`
ThreadPrefixOrphan string `ini:"thread-prefix-orphan" default:""`
ThreadPrefixLastSibling string `ini:"thread-prefix-last-sibling" default:"└─"`
+ ThreadPrefixDummy string `ini:"thread-prefix-dummy" default:"┬─"`
ThreadPrefixLastSiblingReverse string `ini:"thread-prefix-last-sibling-reverse" default:"┌─"`
ThreadPrefixFirstChildReverse string `ini:"thread-prefix-first-child-reverse" default:""`
ThreadPrefixOrphanReverse string `ini:"thread-prefix-orphan-reverse" default:""`
+ ThreadPrefixDummyReverse string `ini:"thread-prefix-dummy-reverse" default:"┴─"`
// Tab Templates
TabTitleAccount *template.Template `ini:"tab-title-account" default:"{{.Account}}"`
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index e72f2c6a..ded49a14 100644
--- a/doc/aerc-config.5.scd
+++ b/doc/aerc-config.5.scd
@@ -577,6 +577,16 @@ following configurable prefix parts:
Default: _┌─_
+*thread-prefix-dummy* = _<string>_
+ Define the connector for the dummy head.
+
+ Default: _┬─_
+
+*thread-prefix-dummy-reverse* = _<string>_
+ Define the connector for the dummy head in reversed threads.
+
+ Default: _┴─_
+
*thread-prefix-first-child-reverse* = _<string>_
Define the arrow appearance by selecting the first child connector in
@@ -631,6 +641,7 @@ thread-prefix-unfolded = ""
thread-prefix-first-child = "┬"
thread-prefix-has-siblings = "├"
thread-prefix-orphan = "┌"
+thread-prefix-dummy = "┬"
thread-prefix-lone = " "
thread-prefix-last-sibling = "╰"
```
diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go
index bd0bc639..7216274a 100644
--- a/worker/notmuch/lib/database.go
+++ b/worker/notmuch/lib/database.go
@@ -138,6 +138,7 @@ func (db *DB) ThreadsFromQuery(ctx context.Context, q string, entireThread bool)
tlm := thread.TopLevelMessages()
root := db.makeThread(nil, &tlm, entireThread)
if len(root) > 1 {
+ root[0].Dummy = true
root[0].FirstChild = root[0].NextSibling
root[0].NextSibling.PrevSibling = nil
root[0].NextSibling = nil
diff --git a/worker/types/thread.go b/worker/types/thread.go
index 8705ace1..a79a0b2d 100644
--- a/worker/types/thread.go
+++ b/worker/types/thread.go
@@ -18,6 +18,9 @@ type Thread struct {
Hidden int // if this flag is not zero the message isn't rendered in the UI
Deleted bool // if this flag is set the message was deleted
+ // if this flag is set the message is the root of an incomplete thread
+ Dummy bool
+
// Context indicates the message doesn't match the mailbox / query but
// is displayed for context
Context bool