mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 15:14:49 +03:00
dev: ui: cleanup
This commit is contained in:
parent
52d7f99360
commit
d948198303
@ -218,11 +218,13 @@ asHandleNormalMode (ALS scons ass) ev = do
|
||||
VtyEvent (EvKey KEsc []) -> modify' (resetScreens d) -- ESC: reset
|
||||
VtyEvent (EvKey (KChar c) []) | c == '?' -> modify' (setMode Help) -- ?: enter help mode
|
||||
|
||||
-- App events: these do not come from the UI; they are received when --watch is used.
|
||||
-- XXX currently these are handled only in Normal mode
|
||||
-- AppEvents come from the system, in --watch mode.
|
||||
-- XXX currently they are handled only in Normal mode
|
||||
-- XXX be sure we don't leave unconsumed app events piling up
|
||||
-- A data file has changed (or the user has pressed g): reload.
|
||||
e | e `elem` [AppEvent FileChange, VtyEvent (EvKey (KChar 'g') [])] -> liftIO (uiReloadJournal copts d ui) >>= put'
|
||||
e | e `elem` [AppEvent FileChange, VtyEvent (EvKey (KChar 'g') [])] ->
|
||||
liftIO (uiReloadJournal copts d ui) >>= put'
|
||||
|
||||
-- The date has changed (and we are viewing a standard period which contained the old date):
|
||||
-- adjust the viewed period and regenerate, just in case needed.
|
||||
-- (Eg: when watching data for "today" and the time has just passed midnight.)
|
||||
|
@ -234,12 +234,16 @@ rsHandle ev = do
|
||||
VtyEvent (EvKey (KChar 'q') []) -> halt
|
||||
VtyEvent (EvKey KEsc []) -> put' $ resetScreens d ui
|
||||
VtyEvent (EvKey (KChar c) []) | c == '?' -> put' $ setMode Help ui
|
||||
|
||||
-- AppEvents arrive in --watch mode, see AccountsScreen
|
||||
AppEvent (DateChange old _) | isStandardPeriod p && p `periodContainsDate` old ->
|
||||
put' $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui
|
||||
where
|
||||
p = reportPeriod ui
|
||||
e | e `elem` [VtyEvent (EvKey (KChar 'g') []), AppEvent FileChange] ->
|
||||
|
||||
e | e `elem` [AppEvent FileChange, VtyEvent (EvKey (KChar 'g') [])] ->
|
||||
liftIO (uiReloadJournal copts d ui) >>= put'
|
||||
|
||||
VtyEvent (EvKey (KChar 'I') []) -> put' $ uiCheckBalanceAssertions d (toggleIgnoreBalanceAssertions ui)
|
||||
VtyEvent (EvKey (KChar 'a') []) -> suspendAndResume $ clearScreen >> setCursorPosition 0 0 >> add copts j >> uiReloadJournalIfChanged copts d j ui
|
||||
VtyEvent (EvKey (KChar 'A') []) -> suspendAndResume $ void (runIadd (journalFilePath j)) >> uiReloadJournalIfChanged copts d j ui
|
||||
|
Loading…
Reference in New Issue
Block a user