feat(xan): Any user input cancels autocommands

This is quite straightforward - any time the user presses a key that
resolves to a command, cancel any active autocommands.

Change-Id: Ibb48b0281b0dc6536d75c8957f8c8e5533ff6630
Reviewed-on: https://cl.tvl.fyi/c/depot/+/731
Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
Griffin Smith 2020-06-28 20:00:07 -04:00 committed by glittershark
parent 90bfbb1667
commit e2273389d5

View file

@ -112,6 +112,7 @@ handleNoPromptEvent :: BrickEvent ResourceName AppEvent -> AppM (Next GameState)
handleNoPromptEvent (VtyEvent (EvKey k mods)) handleNoPromptEvent (VtyEvent (EvKey k mods))
| Just command <- commandFromKey k mods | Just command <- commandFromKey k mods
= do messageHistory %= nextTurn = do messageHistory %= nextTurn
cancelAutocommand
handleCommand command handleCommand command
handleNoPromptEvent (AppEvent AutoContinue) = do handleNoPromptEvent (AppEvent AutoContinue) = do
preuse (autocommand . _ActiveAutocommand . _1) >>= traverse_ autoStep preuse (autocommand . _ActiveAutocommand . _1) >>= traverse_ autoStep