From 1642b1e5915c5f74e5d4627b652fbd8b5c5bbd39 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 30 Apr 2017 13:44:50 +0200 Subject: renderTreeView1: show authors when there's no subject --- RenderTreeView.hs | 20 +++++++++++++++++--- 1 file 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 = -- cgit v1.2.3