@@ -2,14 +2,13 @@
22-- Copyright 2009-2010 Corey O'Connor
33{-# OPTIONS_GHC -Wall #-}
44{-# LANGUAGE ForeignFunctionInterface #-}
5−module Graphics.Vty.LLInput ( Key(..)
6− , Modifier(..)
7− , Button(..)
8− , Event(..)
9− , initTermInput
10− )
5+module Graphics.Vty.Input ( module Graphics.Vty.Input.Data
6+ , initTermInput
7+ )
118 where
129
10+import Graphics.Vty.Input.Data
11+
1312import Data.Char
1413import Data.Maybe ( mapMaybe
1514 )
@@ -36,30 +35,6 @@ import System.Posix.IO ( stdInput
3635
3736import Foreign ( alloca, poke, peek, Ptr )
3837
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)
44−
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)
50−
51−-- |Mouse buttons. Not yet used.
52−data Button = BLeft | BMiddle | BRight
53− deriving (Eq,Show,Ord)
54−
55−-- |Generic events.
56−data Event = EvKey Key [Modifier] | EvMouse Int Int Button [Modifier]
57− | EvResize Int Int
58− deriving (Eq,Show,Ord)
59−
60−data KClass = Valid Key [Modifier] | Invalid | Prefix | MisPfx Key [Modifier] [Char]
61− deriving(Show)
62−
6338-- | Set up the terminal for input. Returns a function which reads key
6439-- events, and a function for shutting down the terminal access.
6540initTermInput :: Int -> Terminal -> IO (IO Event, IO ())
@@ -148,19 +123,8 @@ initTermInput escDelay terminal = do
148123
149124 classifyTab = compile (caps_classify_table : ansi_classify_table)
150125
151− caps_tabls = [("khome", (KHome, [])),
152− ("kend", (KEnd, [])),
153− ("cbt", (KBackTab, [])),
154− ("kcud1", (KDown, [])),
155− ("kcuu1", (KUp, [])),
156− ("kcuf1", (KRight, [])),
157− ("kcub1", (KLeft, [])),
158−
159− ("kLFT", (KLeft, [MShift])),
160− ("kRIT", (KRight, [MShift]))
161− ]
162−
163− caps_classify_table = [(x,y) | (Just x,y) <- map (first (getCapability terminal . tiGetStr)) $ caps_tabls]
126+ caps_classify_table
127+ = map_to_legacy_table [(x,y) | (Just x,y) <- map (first (getCapability terminal . tiGetStr)) $ caps_table]
164128
165129 ansi_classify_table :: [[([Char], (Key, [Modifier]))]]
166130 ansi_classify_table =