@@ -17,14 +17,13 @@ type App = RWST Vty () (Seq String) IO
1717
1818main = do
1919 vty <- mkVty def
20− _ <- execRWST vty_interact vty Seq.empty
20+ _ <- execRWST (vty_interact False) vty Seq.empty
2121 shutdown vty
2222
23−vty_interact :: App ()
24−vty_interact = do
23+vty_interact :: Bool -> App ()
24+vty_interact should_exit = do
2525 update_display
26− done <- handle_next_event
27− unless done vty_interact
26+ unless should_exit $ handle_next_event >>= vty_interact
2827
2928update_display :: App ()
3029update_display = do
@@ -36,8 +35,7 @@ update_display = do
3635
3736handle_next_event = ask >>= liftIO . next_event >>= handle_event
3837 where
39− handle_event (EvKey KEsc []) = return True
4038 handle_event e = do
4139 modify $ (<|) (show e) >>> Seq.take event_buffer_size
42− return False
40+ return $ e == EvKey KEsc []
4341