summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-12-31 12:45:04 +0100
committertv <tv@shackspace.de>2014-12-31 12:45:04 +0100
commit51a9cbe24f0f18534109f35685c803422e3379b1 (patch)
tree1f80e4ad07fd3294244a9aafd65d5b646233e32e
parentae78e7c5cd538c6863d1f602af295e91e2e43d47 (diff)
"&" toggles "killed" tag
-rw-r--r--TreeViewRaw.hs23
-rw-r--r--test5.hs1
2 files changed, 21 insertions, 3 deletions
diff --git a/TreeViewRaw.hs b/TreeViewRaw.hs
index 52ea966..72e2ba3 100644
--- a/TreeViewRaw.hs
+++ b/TreeViewRaw.hs
@@ -49,13 +49,21 @@ renderTreeView now cur _loc@(Node label children) =
-- TODO locale-style: headerKey = \s -> SGR [..] (s <> ": ")
-searchSGR, focusSGR, boringSGR, dateSGR, tagsSGR, unreadMessageSGR,
- unreadSearchSGR :: Trammel String -> Trammel String
+searchSGR
+ , focusSGR
+ , boringSGR
+ , dateSGR
+ , tagsSGR
+ , unreadMessageSGR
+ , unreadSearchSGR
+ , killedTagSGR
+ :: Trammel String -> Trammel String
searchSGR = SGR [38,5,162]
focusSGR = SGR [38,5,160]
boringSGR = SGR [38,5,240]
dateSGR = SGR [38,5,071]
tagsSGR = SGR [38,5,036]
+killedTagSGR = SGR [38,5,088]
unreadMessageSGR = SGR [38,5,117]
unreadSearchSGR = SGR [38,5,250]
@@ -127,7 +135,16 @@ renderFrom = \case
renderTags :: [Tag] -> Trammel String
renderTags =
- Plain . T.unpack . T.intercalate " " . L.sort
+ -- TODO sort somewhere else
+ mconcat . L.intersperse " " . map renderTag . L.sort
+
+
+renderTag :: Tag -> Trammel String
+renderTag tag = case tag of
+ "killed" -> killedTagSGR plain
+ _ -> plain
+ where
+ plain = Plain $ T.unpack tag
dropAddress :: String -> String
diff --git a/test5.hs b/test5.hs
index 470e780..20d97fb 100644
--- a/test5.hs
+++ b/test5.hs
@@ -214,6 +214,7 @@ keymap :: String -> State -> IO State
keymap "a" = toggleTagAtCursor "inbox"
keymap "s" = toggleTagAtCursor "unread"
+keymap "&" = toggleTagAtCursor "killed"
keymap "r" = replyToAll
keymap "e" = viewSource
keymap "t" = editTags