summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-04-30 13:44:50 +0200
committertv <tv@krebsco.de>2017-04-30 15:46:31 +0200
commit1642b1e5915c5f74e5d4627b652fbd8b5c5bbd39 (patch)
tree6dc16b5880a6bb1f303f26b2b8d58f2d68a735a0
parent4b2678b530ccf98061f3372d76e472af2e9359b3 (diff)
renderTreeView1: show authors when there's no subject
-rw-r--r--RenderTreeView.hs20
1 files changed, 17 insertions, 3 deletions
diff --git a/RenderTreeView.hs b/RenderTreeView.hs
index 21a6771..9548c78 100644
--- a/RenderTreeView.hs
+++ b/RenderTreeView.hs
@@ -106,6 +106,7 @@ endPrefix = prefixSGR "└╴"
-- TODO locale-style: headerKey = \s -> SGR [..] (s <> ": ")
searchSGR
+ , altSGR
, focusSGR
, quoteSGR
, boringSGR
@@ -117,6 +118,8 @@ searchSGR
, killedTagSGR
, starTagSGR
:: Blessings String -> Blessings String
+
+altSGR = SGR [38,5,182]
searchSGR = SGR [38,5,162]
focusSGR = SGR [38,5,160]
quoteSGR = SGR [38,5,242]
@@ -142,13 +145,24 @@ renderTreeView1 now hasFocus x = case x of
TVSearchResult sr ->
let c = if hasFocus then focusSGR else
- if "unread" `elem` Notmuch.searchTags sr
+ if isUnread
then unreadSearchSGR
else boringSGR
+ c_authors =
+ if hasFocus then focusSGR else
+ if isUnread
+ then altSGR
+ else boringSGR
+
+ isUnread = "unread" `elem` Notmuch.searchTags sr
+
+ authors = Plain $ T.unpack $ Notmuch.searchAuthors sr
date = dateSGR $ renderDate now x
+ subject = Plain $ T.unpack $ Notmuch.searchSubject sr
tags = tagsSGR $ renderTags (Notmuch.searchTags sr)
- subj = Plain $ T.unpack $ Notmuch.searchSubject sr
- in c $ subj <> " " <> date <> " " <> tags
+ title = if subject /= "" then subject else c_authors authors
+ in
+ c $ title <> " " <> date <> " " <> tags
TVMessage m ->
let fromSGR =