about summary refs log tree commit diff
path: root/src/Xanthous/App.hs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-09-02T14·36-0400
committerGriffin Smith <root@gws.fyi>2019-09-02T14·52-0400
commit18551cdf30c0a13bce40fae9be829e5318612e71 (patch)
treeabb2c73133a4ae99852bd5865c78b4c301943d05 /src/Xanthous/App.hs
parentadb3b74c0c3a3bffa0d47f52036fde3623f859f7 (diff)
Add a previous message command
Add a "previous message" command, triggered via ctrl+p.

I attempted here to get the message area to still take up a row of space
post-hiding the message, but failed - should revisit that at some point
Diffstat (limited to 'src/Xanthous/App.hs')
-rw-r--r--src/Xanthous/App.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Xanthous/App.hs b/src/Xanthous/App.hs
index c543ad468f6d..3561d35a3bb2 100644
--- a/src/Xanthous/App.hs
+++ b/src/Xanthous/App.hs
@@ -35,7 +35,8 @@ startEvent = say ["welcome"]
 handleEvent :: BrickEvent Name () -> AppM (Next GameState)
 handleEvent (VtyEvent (EvKey k mods))
   | Just command <- commandFromKey k mods
-  = handleCommand command
+  = do messageHistory %= hideMessage
+       handleCommand command
 handleEvent _ = continue
 
 handleCommand :: Command -> AppM (Next GameState)
@@ -43,4 +44,7 @@ handleCommand Quit = halt
 handleCommand (Move dir) = do
   characterPosition %= move dir
   continue
-handleCommand _ = error "unimplemented"
+
+handleCommand PreviousMessage = do
+  messageHistory %= popMessage
+  continue