ui: clear screen before add

This commit is contained in:
Simon Michael 2016-06-09 12:42:47 -07:00
parent 6c6222ef85
commit 499f249157
4 changed files with 7 additions and 2 deletions

View File

@ -28,6 +28,7 @@ import Brick.Widgets.Edit
import Brick.Widgets.Border (borderAttr)
-- import Brick.Widgets.Center
import Lens.Micro.Platform
import System.Console.ANSI
import Hledger
import Hledger.Cli hiding (progname,prognameandversion,green)
@ -256,7 +257,7 @@ asHandle st'@AppState{
-- Vty.EvKey (Vty.KChar 'l') [Vty.MCtrl] -> do
Vty.EvKey Vty.KEsc [] -> continue $ resetScreens d st
Vty.EvKey (Vty.KChar 'g') [] -> liftIO (stReloadJournalIfChanged copts d j st) >>= continue
Vty.EvKey (Vty.KChar 'a') [] -> suspendAndResume $ add copts j >> stReloadJournalIfChanged copts d j st
Vty.EvKey (Vty.KChar 'a') [] -> suspendAndResume $ clearScreen >> setCursorPosition 0 0 >> add copts j >> stReloadJournalIfChanged copts d j st
Vty.EvKey (Vty.KChar '-') [] -> continue $ regenerateScreens j d $ decDepth st
Vty.EvKey (Vty.KChar '+') [] -> continue $ regenerateScreens j d $ incDepth st
Vty.EvKey (Vty.KChar '=') [] -> continue $ regenerateScreens j d $ incDepth st

View File

@ -24,8 +24,10 @@ import Brick.Widgets.List
import Brick.Widgets.Edit
import Brick.Widgets.Border (borderAttr)
-- import Brick.Widgets.Center
import System.Console.ANSI
-- import Text.Printf
import Hledger
import Hledger.Cli hiding (progname,prognameandversion,green)
import Hledger.UI.UIOptions
@ -236,7 +238,7 @@ rsHandle st@AppState{
Vty.EvKey (Vty.KChar 'q') [] -> halt st
Vty.EvKey Vty.KEsc [] -> continue $ resetScreens d st
Vty.EvKey (Vty.KChar 'g') [] -> liftIO (stReloadJournalIfChanged copts d j st) >>= continue
Vty.EvKey (Vty.KChar 'a') [] -> suspendAndResume $ add copts j >> stReloadJournalIfChanged copts d j st
Vty.EvKey (Vty.KChar 'a') [] -> suspendAndResume $ clearScreen >> setCursorPosition 0 0 >> add copts j >> stReloadJournalIfChanged copts d j st
Vty.EvKey (Vty.KChar 'E') [] -> scrollTop >> (continue $ regenerateScreens j d $ stToggleEmpty st)
Vty.EvKey (Vty.KChar 'C') [] -> scrollTop >> (continue $ regenerateScreens j d $ stToggleCleared st)
Vty.EvKey (Vty.KChar 'U') [] -> scrollTop >> (continue $ regenerateScreens j d $ stToggleUncleared st)

View File

@ -72,6 +72,7 @@ executables:
dependencies:
- hledger >= 0.28 && < 0.29
- hledger-lib >= 0.28 && < 0.29
- ansi-terminal >= 0.6.2.3 && < 0.7
- base >= 3 && < 5
- base-compat >= 0.8.1
- brick >= 0.2 && < 0.5

View File

@ -63,6 +63,7 @@ executable hledger-ui
build-depends:
hledger >= 0.28 && < 0.29
, hledger-lib >= 0.28 && < 0.29
, ansi-terminal >= 0.6.2.3 && < 0.7
, base >= 3 && < 5
, base-compat >= 0.8.1
, brick >= 0.2 && < 0.7