ui: reorganise help dialog, fit content into 80x25 again
This commit is contained in:
		
							parent
							
								
									cf6f4ed28c
								
							
						
					
					
						commit
						2a44d7eb26
					
				| @ -25,7 +25,7 @@ import Lens.Micro.Platform | |||||||
| import System.Environment | import System.Environment | ||||||
| 
 | 
 | ||||||
| import Hledger hiding (Color) | import Hledger hiding (Color) | ||||||
| import Hledger.Cli (CliOpts(rawopts_)) | import Hledger.Cli (CliOpts) | ||||||
| import Hledger.Cli.DocFiles | import Hledger.Cli.DocFiles | ||||||
| import Hledger.UI.UITypes | import Hledger.UI.UITypes | ||||||
| import Hledger.UI.UIState | import Hledger.UI.UIState | ||||||
| @ -35,76 +35,60 @@ import Hledger.UI.UIState | |||||||
| 
 | 
 | ||||||
| -- | Draw the help dialog, called when help mode is active. | -- | Draw the help dialog, called when help mode is active. | ||||||
| helpDialog :: CliOpts -> Widget Name | helpDialog :: CliOpts -> Widget Name | ||||||
| helpDialog copts = | helpDialog _copts = | ||||||
|   Widget Fixed Fixed $ do |   Widget Fixed Fixed $ do | ||||||
|     c <- getContext |     c <- getContext | ||||||
|     render $ |     render $ | ||||||
|       renderDialog (dialog (Just "Help (?/LEFT/ESC to close)") Nothing (c^.availWidthL)) $ -- (Just (0,[("ok",())])) |       renderDialog (dialog (Just "Help (?/LEFT/ESC to close)") Nothing (c^.availWidthL)) $ -- (Just (0,[("ok",())])) | ||||||
|       padTopBottom 1 $ padLeftRight 1 $ |       padAll 1 $ | ||||||
|         vBox [ |         vBox [ | ||||||
|            hBox [ |            hBox [ | ||||||
|               padLeftRight 1 $ |               padRight (Pad 1) $ | ||||||
|                 vBox [ |                 vBox [ | ||||||
|                    str "NAVIGATION" |                    str "Navigation" | ||||||
|                   ,renderKey ("UP/DOWN/PGUP/PGDN/HOME/END", "") |                   ,renderKey ("UP/DOWN/PUP/PDN/HOME/END/emacs/vi keys", "") | ||||||
|                   ,str "  move selection" |                   ,str "      move selection" | ||||||
|                   ,renderKey ("RIGHT", "more detail") |                   ,renderKey ("RIGHT", "show more detail") | ||||||
|                   ,renderKey ("LEFT", "previous screen") |                   ,renderKey ("LEFT ", "go back") | ||||||
|                   ,str "  (or vi/emacs movement keys)" |                   ,renderKey ("ESC  ", "cancel or reset") | ||||||
|                   ,renderKey ("ESC", "cancel / reset to top") |  | ||||||
|                   ,str " " |                   ,str " " | ||||||
|                   ,str "MISC" |                   ,str "Report period" | ||||||
|                   ,renderKey ("?", "toggle help") |                   ,renderKey ("S-DOWN /S-UP  ", "shrink/grow period") | ||||||
|                   ,renderKey ("a", "add transaction (hledger add)") |                   ,renderKey ("S-RIGHT/S-LEFT", "next/previous period") | ||||||
|                   ,renderKey ("A", "add transaction (hledger-iadd)") |                   ,renderKey ("t             ", "set period to today") | ||||||
|                   ,renderKey ("E", "open editor") |                   ,str " " | ||||||
|                   ,renderKey ("I", "toggle balance assertions") |                   ,str "Accounts screen" | ||||||
|                   ,renderKey ("CTRL-l", "redraw & recenter") |                   ,renderKey ("-+0123456789 ", "set depth limit") | ||||||
|                   ,renderKey ("g", "reload data") |                   ,renderKey ("T ", "toggle tree/flat mode") | ||||||
|                   ,renderKey ("q", "quit") |                   ,renderKey ("H ", "period change/historical end balance") | ||||||
|  |                   ,str " " | ||||||
|  |                   ,str "Register screen" | ||||||
|  |                   ,renderKey ("T ", "toggle subaccount txns\n(and accounts screen tree/flat mode)") | ||||||
|  |                   ,renderKey ("H ", "show period total/historical total") | ||||||
|                   ,str " " |                   ,str " " | ||||||
|                   ,str "MANUAL" |  | ||||||
|                   ,str "choose format:" |  | ||||||
|                   ,renderKey ("p", "pager") |  | ||||||
|                   ,renderKey ("m", "man") |  | ||||||
|                   ,renderKey ("i", "info") |  | ||||||
|                 ] |                 ] | ||||||
|              ,padLeftRight 1 $ |              ,padLeft (Pad 1) $ padRight (Pad 0) $ | ||||||
|                 vBox [ |                 vBox [ | ||||||
|                    str "FILTERING" |                    str "Filtering" | ||||||
|                   ,renderKey ("SHIFT-DOWN/UP", "shrink/grow report period") |                   ,renderKey ("/   ", "set a filter query") | ||||||
|                   ,renderKey ("SHIFT-RIGHT/LEFT", "next/previous report period") |                   ,renderKey ("UPC ", "show unmarked/pending/cleared")  | ||||||
|                   ,renderKey ("t", "set report period to today") |                   ,renderKey ("F   ", "show future/present txns") | ||||||
|  |                   ,renderKey ("R   ", "show real/all postings") | ||||||
|  |                   ,renderKey ("Z   ", "show nonzero/all amounts") | ||||||
|  |                   ,renderKey ("DEL ", "remove filters") | ||||||
|                   ,str " " |                   ,str " " | ||||||
|                   ,renderKey ("/", "set a filter query") |                   ,str "Help" | ||||||
|                   ,renderKey ("U",  |                   ,renderKey ("?   ", "toggle this help") | ||||||
|                     ["toggle unmarked/all" |                   ,renderKey ("pmi ", "(with help showing)\nshow manual in pager/man/info") | ||||||
|                     ,"cycle unmarked/not unmarked/all" |  | ||||||
|                     ,"toggle unmarked filter" |  | ||||||
|                     ] !! (statusstyle-1)) |  | ||||||
|                   ,renderKey ("P", |  | ||||||
|                     ["toggle pending/all" |  | ||||||
|                     ,"cycle pending/not pending/all" |  | ||||||
|                     ,"toggle pending filter" |  | ||||||
|                     ] !! (statusstyle-1)) |  | ||||||
|                   ,renderKey ("C", |  | ||||||
|                     ["toggle cleared/all" |  | ||||||
|                     ,"cycle cleared/not cleared/all" |  | ||||||
|                     ,"toggle cleared filter" |  | ||||||
|                     ] !! (statusstyle-1)) |  | ||||||
|                   ,renderKey ("F", "toggle future/present") |  | ||||||
|                   ,renderKey ("R", "toggle real/all") |  | ||||||
|                   ,renderKey ("Z", "toggle nonzero/all") |  | ||||||
|                   ,renderKey ("DEL/BS", "remove filters") |  | ||||||
|                   ,str " " |                   ,str " " | ||||||
|                   ,str "accounts screen:" |                   ,str "Other" | ||||||
|                   ,renderKey ("-+0123456789", "set depth limit") |                   ,renderKey ("a   ", "add transaction (hledger add)") | ||||||
|                   ,renderKey ("H", "toggle period balance (shows change) or\nhistorical balance (includes older postings)") |                   ,renderKey ("A   ", "add transaction (hledger-iadd)") | ||||||
|                   ,renderKey ("T", "toggle tree (amounts include subaccounts) or\nflat mode (amounts exclude subaccounts\nexcept at depth limit)") |                   ,renderKey ("E   ", "open editor") | ||||||
|                   ,str " " |                   ,renderKey ("I   ", "toggle balance assertions") | ||||||
|                   ,str "register screen:" |                   ,renderKey ("C-l ", "redraw & recenter") | ||||||
|                   ,renderKey ("H", "toggle period or historical total") |                   ,renderKey ("g   ", "reload data") | ||||||
|                   ,renderKey ("T", "toggle inclusion of subaccount transactions\n(and tree/flat mode on accounts screen)") |                   ,renderKey ("q   ", "quit") | ||||||
|                 ] |                 ] | ||||||
|              ] |              ] | ||||||
| --           ,vBox [ | --           ,vBox [ | ||||||
| @ -123,7 +107,6 @@ helpDialog copts = | |||||||
|           ] |           ] | ||||||
|   where |   where | ||||||
|     renderKey (key,desc) = withAttr (borderAttr <> "keys") (str key) <+> str " " <+> str desc |     renderKey (key,desc) = withAttr (borderAttr <> "keys") (str key) <+> str " " <+> str desc | ||||||
|     statusstyle = min 3 $ fromMaybe 1 $ maybeintopt "status-toggles" $ rawopts_ copts  |  | ||||||
| 
 | 
 | ||||||
| -- | Event handler used when help mode is active. | -- | Event handler used when help mode is active. | ||||||
| -- May invoke $PAGER, less, man or info, which is likely to fail on MS Windows, TODO. | -- May invoke $PAGER, less, man or info, which is likely to fail on MS Windows, TODO. | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user