From 47a77b3d359d23166ee72462154617611fdfb98e Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 25 Feb 2017 22:14:24 -0700 Subject: break down the action keys into handlers --- Main.hs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'Main.hs') diff --git a/Main.hs b/Main.hs index 6fa6944..8ca6351 100644 --- a/Main.hs +++ b/Main.hs @@ -67,16 +67,36 @@ drawUI st = [ui] ) handleQ :: St -> EventM () (Next St) -handleQ st = undefined +handleQ st = ifScanSess st + (finishScanSess st >>= continue) + (halt st) handleRET :: St -> EventM () (Next St) -handleRET st = undefined +handleRET st = ifScanSess st + (scanNextPage st >>= finishScanSess >>= continue) + (beginScanSess st >>= scanNextPage >>= finishScanSess >>= continue) handleSPC :: St -> EventM () (Next St) -handleSPC st = undefined +handleSPC st = ifScanSess st + (scanNextPage st >>= continue) + (beginScanSess st >>= scanNextPage >>= continue) handleESC :: St -> EventM () (Next St) -handleESC st = undefined +handleESC st = ifScanSess st + (abortScanSess st >>= continue) + (continue st) + +beginScanSess :: St -> EventM () St +beginScanSess st = undefined + +abortScanSess :: St -> EventM () St +abortScanSess st = undefined + +finishScanSess :: St -> EventM () St +finishScanSess st = undefined + +scanNextPage :: St -> EventM () St +scanNextPage st = undefined handleHotKey :: St -> Char -> EventM () (Next St) handleHotKey st 'q' = handleQ st -- cgit v1.2.3