aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-02-25 21:49:29 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-02-25 21:49:29 -0700
commitb1fd0291e72b4235a4cd25ac4f40d236dd0ee8c8 (patch)
tree0dee1f035d1b1d0a4b087b9fc4a1f9831d569ab7
parent4e2f8eb3db3d16b9ad66db63fcc1503b6181cadd (diff)
downloadsscan-b1fd0291e72b4235a4cd25ac4f40d236dd0ee8c8.tar.gz
ESC to abort a scanning session
-rw-r--r--Main.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Main.hs b/Main.hs
index 1dc04e2..79f5b49 100644
--- a/Main.hs
+++ b/Main.hs
@@ -55,6 +55,7 @@ drawUI st = [ui]
then [ ("SPC", "scan next page")
, ("RET", "scan final page")
, ("q", "declare last scanned page was the final page")
+ , ("ESC", "abort/restart scanning this document")
]
else [ ("SPC", "scan first page of multi-page document")
, ("RET", "scan single page document")
@@ -75,6 +76,9 @@ handleRET st = undefined
handleSPC :: St -> EventM () (Next St)
handleSPC st = undefined
+handleESC :: St -> EventM () (Next St)
+handleESC st = undefined
+
handleHotKey :: St -> Char -> EventM () (Next St)
handleHotKey st 'q' = handleQ st
handleHotKey st ' ' = handleSPC st
@@ -100,6 +104,7 @@ appEvent :: St -> BrickEvent () e -> EventM () (Next St)
appEvent st (VtyEvent e) =
case e of
V.EvKey (V.KEnter) [] -> handleRET st
+ V.EvKey (V.KEsc) [] -> handleESC st
V.EvKey (V.KChar c) [] -> handleHotKey st c
_ -> continue st
appEvent st _ = continue st