mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 12:54:07 +03:00
ui: q exits help; improve help layout (#1286)
This commit is contained in:
parent
ae830a1ace
commit
bac3028704
@ -286,7 +286,7 @@ asHandle ui0@UIState{
|
|||||||
|
|
||||||
Help ->
|
Help ->
|
||||||
case ev of
|
case ev of
|
||||||
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
-- VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
||||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||||
VtyEvent (EvKey (KChar 'z') [MCtrl]) -> suspend ui
|
VtyEvent (EvKey (KChar 'z') [MCtrl]) -> suspend ui
|
||||||
_ -> helpHandle ui ev
|
_ -> helpHandle ui ev
|
||||||
|
@ -302,7 +302,7 @@ rsHandle ui@UIState{
|
|||||||
|
|
||||||
Help ->
|
Help ->
|
||||||
case ev of
|
case ev of
|
||||||
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
-- VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
||||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||||
VtyEvent (EvKey (KChar 'z') [MCtrl]) -> suspend ui
|
VtyEvent (EvKey (KChar 'z') [MCtrl]) -> suspend ui
|
||||||
_ -> helpHandle ui ev
|
_ -> helpHandle ui ev
|
||||||
|
@ -141,7 +141,7 @@ tsHandle ui@UIState{aScreen=s@TransactionScreen{tsTransaction=(i,t)
|
|||||||
case mode of
|
case mode of
|
||||||
Help ->
|
Help ->
|
||||||
case ev of
|
case ev of
|
||||||
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
-- VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
||||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||||
VtyEvent (EvKey (KChar 'z') [MCtrl]) -> suspend ui
|
VtyEvent (EvKey (KChar 'z') [MCtrl]) -> suspend ui
|
||||||
_ -> helpHandle ui ev
|
_ -> helpHandle ui ev
|
||||||
|
@ -90,7 +90,7 @@ helpDialog _copts =
|
|||||||
c <- getContext
|
c <- getContext
|
||||||
render $
|
render $
|
||||||
withDefAttr "help" $
|
withDefAttr "help" $
|
||||||
renderDialog (dialog (Just "Help (?/LEFT/ESC to close)") Nothing (c^.availWidthL)) $ -- (Just (0,[("ok",())]))
|
renderDialog (dialog (Just "Help (LEFT/ESC/?/q to close help)") Nothing (c^.availWidthL)) $ -- (Just (0,[("ok",())]))
|
||||||
padTop (Pad 0) $ padLeft (Pad 1) $ padRight (Pad 1) $
|
padTop (Pad 0) $ padLeft (Pad 1) $ padRight (Pad 1) $
|
||||||
vBox [
|
vBox [
|
||||||
hBox [
|
hBox [
|
||||||
@ -102,12 +102,8 @@ helpDialog _copts =
|
|||||||
,renderKey ("RIGHT/l/C-f", "")
|
,renderKey ("RIGHT/l/C-f", "")
|
||||||
,str " show account txns, or txn detail"
|
,str " show account txns, or txn detail"
|
||||||
,renderKey ("LEFT/h/C-b ", "go back")
|
,renderKey ("LEFT/h/C-b ", "go back")
|
||||||
,renderKey ("ESC ", "cancel input, or reset UI")
|
,renderKey ("ESC ", "cancel or reset")
|
||||||
,str " "
|
|
||||||
,withAttr ("help" <> "heading") $ str "Report period"
|
|
||||||
,renderKey ("S-DOWN /S-UP ", "shrink/grow period")
|
|
||||||
,renderKey ("S-RIGHT/S-LEFT", "next/previous period")
|
|
||||||
,renderKey ("T ", "set period to today")
|
|
||||||
,str " "
|
,str " "
|
||||||
,withAttr ("help" <> "heading") $ str "Accounts screen"
|
,withAttr ("help" <> "heading") $ str "Accounts screen"
|
||||||
,renderKey ("1234567890-+ ", "set/adjust depth limit")
|
,renderKey ("1234567890-+ ", "set/adjust depth limit")
|
||||||
@ -118,6 +114,10 @@ helpDialog _copts =
|
|||||||
,renderKey ("t ", "toggle subaccount txns\n(and accounts tree/list mode)")
|
,renderKey ("t ", "toggle subaccount txns\n(and accounts tree/list mode)")
|
||||||
,renderKey ("H ", "toggle historical/period total")
|
,renderKey ("H ", "toggle historical/period total")
|
||||||
,str " "
|
,str " "
|
||||||
|
,withAttr ("help" <> "heading") $ str "Help"
|
||||||
|
,renderKey ("? ", "toggle this help")
|
||||||
|
,renderKey ("p/m/i", "while help is open:\nshow manual in pager/man/info")
|
||||||
|
,str " "
|
||||||
]
|
]
|
||||||
,padLeft (Pad 1) $ padRight (Pad 0) $
|
,padLeft (Pad 1) $ padRight (Pad 0) $
|
||||||
vBox [
|
vBox [
|
||||||
@ -128,11 +128,10 @@ helpDialog _copts =
|
|||||||
,renderKey ("R ", "show real/all postings")
|
,renderKey ("R ", "show real/all postings")
|
||||||
,renderKey ("Z ", "show nonzero/all amounts")
|
,renderKey ("Z ", "show nonzero/all amounts")
|
||||||
,renderKey ("DEL ", "remove filters")
|
,renderKey ("DEL ", "remove filters")
|
||||||
|
,renderKey ("S-DOWN /S-UP ", "shrink/grow period")
|
||||||
|
,renderKey ("S-RIGHT/S-LEFT", "next/previous period")
|
||||||
|
,renderKey ("T ", "set period to today")
|
||||||
,str " "
|
,str " "
|
||||||
,withAttr ("help" <> "heading") $ str "Help"
|
|
||||||
,renderKey ("? ", "toggle this help")
|
|
||||||
,renderKey ("p/m/i", "(with this help open)\nshow manual in pager/man/info")
|
|
||||||
-- ,str " " -- need one more line in 80x25
|
|
||||||
,withAttr ("help" <> "heading") $ str "Other"
|
,withAttr ("help" <> "heading") $ str "Other"
|
||||||
,renderKey ("a ", "add transaction (hledger add)")
|
,renderKey ("a ", "add transaction (hledger add)")
|
||||||
,renderKey ("A ", "add transaction (hledger-iadd)")
|
,renderKey ("A ", "add transaction (hledger-iadd)")
|
||||||
@ -169,7 +168,9 @@ helpHandle :: UIState -> BrickEvent Name AppEvent -> EventM Name (Next UIState)
|
|||||||
helpHandle ui ev = do
|
helpHandle ui ev = do
|
||||||
pagerprog <- liftIO $ fromMaybe "less" <$> lookupEnv "PAGER"
|
pagerprog <- liftIO $ fromMaybe "less" <$> lookupEnv "PAGER"
|
||||||
case ev of
|
case ev of
|
||||||
VtyEvent e | e `elem` (moveLeftEvents ++ [EvKey KEsc [], EvKey (KChar '?') []]) -> continue $ setMode Normal ui
|
VtyEvent e
|
||||||
|
| e `elem` (moveLeftEvents ++ [EvKey KEsc [], EvKey (KChar '?') [], EvKey (KChar 'q') []])
|
||||||
|
-> continue $ setMode Normal ui
|
||||||
VtyEvent (EvKey (KChar 'p') []) -> suspendAndResume $ runPagerForTopic pagerprog "hledger-ui" >> return ui'
|
VtyEvent (EvKey (KChar 'p') []) -> suspendAndResume $ runPagerForTopic pagerprog "hledger-ui" >> return ui'
|
||||||
VtyEvent (EvKey (KChar 'm') []) -> suspendAndResume $ runManForTopic "hledger-ui" >> return ui'
|
VtyEvent (EvKey (KChar 'm') []) -> suspendAndResume $ runManForTopic "hledger-ui" >> return ui'
|
||||||
VtyEvent (EvKey (KChar 'i') []) -> suspendAndResume $ runInfoForTopic "hledger-ui" >> return ui'
|
VtyEvent (EvKey (KChar 'i') []) -> suspendAndResume $ runInfoForTopic "hledger-ui" >> return ui'
|
||||||
|
@ -95,7 +95,7 @@ which should contain one command line option/argument per line.
|
|||||||
|
|
||||||
`?` shows a help dialog listing all keys.
|
`?` shows a help dialog listing all keys.
|
||||||
(some of these also appear in the quick help at the bottom of each screen.)
|
(some of these also appear in the quick help at the bottom of each screen.)
|
||||||
press `?` again (or `escape`, or `left`) to close it.
|
press `?` again (or `escape`, or `left`, or `q`) to close it.
|
||||||
the following keys work on most screens:
|
the following keys work on most screens:
|
||||||
|
|
||||||
the cursor keys navigate:
|
the cursor keys navigate:
|
||||||
|
Loading…
Reference in New Issue
Block a user