From 25a0a7c4dd15bd40dfeb3ebc8281fb1e2eb94b7f Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 3 Sep 2015 21:03:03 -0700 Subject: [PATCH] ui: make keys bold in bottom help --- hledger-ui/Hledger/UI/AccountsScreen.hs | 8 ++++---- hledger-ui/Hledger/UI/RegisterScreen.hs | 4 ++-- hledger-ui/Hledger/UI/Theme.hs | 1 + hledger-ui/Hledger/UI/UIUtils.hs | 9 ++++++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/hledger-ui/Hledger/UI/AccountsScreen.hs b/hledger-ui/Hledger/UI/AccountsScreen.hs index 05626c34e..5a4177222 100644 --- a/hledger-ui/Hledger/UI/AccountsScreen.hs +++ b/hledger-ui/Hledger/UI/AccountsScreen.hs @@ -119,10 +119,10 @@ drawAccountsScreen _st@AppState{aopts=uopts, ajournal=j, aScreen=AccountsScreen{ total = str $ show $ V.length $ l^.listElementsL bottomlabel = borderKeysStr [ - -- "up/down/pgup/pgdown/home/end: move" - "-+1234567890: adjust depth limit" - ,"right: show transactions" - ,"q: quit" + -- ("up/down/pgup/pgdown/home/end", "move") + ("-+1234567890", "adjust depth limit") + ,("right", "show transactions") + ,("q", "quit") ] ui = Widget Greedy Greedy $ do diff --git a/hledger-ui/Hledger/UI/RegisterScreen.hs b/hledger-ui/Hledger/UI/RegisterScreen.hs index 47e43da42..8596d6e1c 100644 --- a/hledger-ui/Hledger/UI/RegisterScreen.hs +++ b/hledger-ui/Hledger/UI/RegisterScreen.hs @@ -151,8 +151,8 @@ drawRegisterScreen AppState{ -- aopts=_uopts@UIOpts{cliopts_=_copts@CliOpts{repo colwidths = (datewidth,descwidth,acctswidth,changewidth,balwidth) bottomlabel = borderKeysStr [ - -- "up/down/pgup/pgdown/home/end: move" - "left: return to accounts" + -- ("up/down/pgup/pgdown/home/end", "move") + ("left", "return to accounts") ] render $ defaultLayout toplabel bottomlabel $ renderList l (drawRegisterItem colwidths) diff --git a/hledger-ui/Hledger/UI/Theme.hs b/hledger-ui/Hledger/UI/Theme.hs index 49b0be9b3..415791173 100644 --- a/hledger-ui/Hledger/UI/Theme.hs +++ b/hledger-ui/Hledger/UI/Theme.hs @@ -70,6 +70,7 @@ themesList = [ (borderAttr <> "bold", white `on` black & bold), (borderAttr <> "query", yellow `on` black & bold), (borderAttr <> "depth", cyan `on` black & bold), + (borderAttr <> "keys", white `on` black & bold), -- ("normal" , black `on` white), ("list" , black `on` white), -- regular list items ("list" <> "selected" , white `on` blue & bold), -- selected list items diff --git a/hledger-ui/Hledger/UI/UIUtils.hs b/hledger-ui/Hledger/UI/UIUtils.hs index 93068d4f6..5b6572791 100644 --- a/hledger-ui/Hledger/UI/UIUtils.hs +++ b/hledger-ui/Hledger/UI/UIUtils.hs @@ -149,8 +149,11 @@ borderDepthStr :: Maybe Int -> Widget borderDepthStr Nothing = str "" borderDepthStr (Just d) = str " to " <+> withAttr (borderAttr <> "depth") (str $ "depth "++show d) -borderKeysStr :: [String] -> Widget -borderKeysStr keydescs = str $ intercalate sep keydescs +borderKeysStr :: [(String,String)] -> Widget +borderKeysStr keydescs = + hBox $ + intersperse sep $ + [withAttr (borderAttr <> "keys") (str keys) <+> str ": " <+> str desc | (keys, desc) <- keydescs] where - sep = " | " + sep = str " | " -- sep = " "