@@ -2,14 +2,13 @@
2-- Copyright 2009-2010 Corey O'Connor
2-- Copyright 2009-2010 Corey O'Connor
3{-# OPTIONS_GHC -Wall #-}
3{-# OPTIONS_GHC -Wall #-}
4{-# LANGUAGE ForeignFunctionInterface #-}
4{-# LANGUAGE ForeignFunctionInterface #-}
5−module Graphics.Vty.LLInput ( Key(..)
5+module Graphics.Vty.Input ( module Graphics.Vty.Input.Data
9− , initTermInput
6+ , initTermInput
10+import Graphics.Vty.Input.Data
13import Data.Char
12import Data.Char
14import Data.Maybe ( mapMaybe
13import Data.Maybe ( mapMaybe
@@ -36,30 +35,6 @@ import System.Posix.IO ( stdInput
37import Foreign ( alloca, poke, peek, Ptr )
36import Foreign ( alloca, poke, peek, Ptr )
39−-- |Representations of non-modifier keys.
40−data Key = KEsc | KFun Int | KBackTab | KPrtScr | KPause | KASCII Char | KBS | KIns
41− | KHome | KPageUp | KDel | KEnd | KPageDown | KBegin | KNP5 | KUp | KMenu
42− | KLeft | KDown | KRight | KEnter
43− deriving (Eq,Show,Ord)
45−-- |Modifier keys. Key codes are interpreted such that users are more likely to
46−-- have Meta than Alt; for instance on the PC Linux console, 'MMeta' will
47−-- generally correspond to the physical Alt key.
48−data Modifier = MShift | MCtrl | MMeta | MAlt
49− deriving (Eq,Show,Ord)
51−-- |Mouse buttons. Not yet used.
52−data Button = BLeft | BMiddle | BRight
53− deriving (Eq,Show,Ord)
56−data Event = EvKey Key [Modifier] | EvMouse Int Int Button [Modifier]
58− deriving (Eq,Show,Ord)
60−data KClass = Valid Key [Modifier] | Invalid | Prefix | MisPfx Key [Modifier] [Char]
63-- | Set up the terminal for input. Returns a function which reads key
38-- | Set up the terminal for input. Returns a function which reads key
64-- events, and a function for shutting down the terminal access.
39-- events, and a function for shutting down the terminal access.
65initTermInput :: Int -> Terminal -> IO (IO Event, IO ())
40initTermInput :: Int -> Terminal -> IO (IO Event, IO ())
@@ -148,19 +123,8 @@ initTermInput escDelay terminal = do
149 classifyTab = compile (caps_classify_table : ansi_classify_table)
124 classifyTab = compile (caps_classify_table : ansi_classify_table)
151− caps_tabls = [("khome", (KHome, [])),
126+ caps_classify_table
152− ("kend", (KEnd, [])),
153− ("cbt", (KBackTab, [])),
154− ("kcud1", (KDown, [])),
155− ("kcuu1", (KUp, [])),
156− ("kcuf1", (KRight, [])),
157− ("kcub1", (KLeft, [])),
159− ("kLFT", (KLeft, [MShift])),
160− ("kRIT", (KRight, [MShift]))
163− caps_classify_table = [(x,y) | (Just x,y) <- map (first (getCapability terminal . tiGetStr)) $ caps_tabls]
127+ = map_to_legacy_table [(x,y) | (Just x,y) <- map (first (getCapability terminal . tiGetStr)) $ caps_table]
165 ansi_classify_table :: [[([Char], (Key, [Modifier]))]]
129 ansi_classify_table :: [[([Char], (Key, [Modifier]))]]
166 ansi_classify_table =
130 ansi_classify_table =