@@ -33,26 +33,26 @@ import System.Console.Terminfo
34-- \todo terminfo meta is not supported.
34-- \todo terminfo meta is not supported.
35-- \todo no 8bit
35-- \todo no 8bit
36−classifyTableForTerm :: String -> Terminal -> ClassifyTable
36+classifyMapForTerm :: String -> Terminal -> ClassifyMap
37−classifyTableForTerm termName term =
37+classifyMapForTerm termName term =
38− concat $ capsClassifyTable term keysFromCapsTable
38+ concat $ capsClassifyMap term keysFromCapsTable
39 : universalTable
39 : universalTable
40 : termSpecificTables termName
40 : termSpecificTables termName
42-- | key table applicable to all terminals.
42-- | key table applicable to all terminals.
44-- TODO: some probably only applicable to ANSI/VT100 terminals.
44-- TODO: some probably only applicable to ANSI/VT100 terminals.
45−universalTable :: ClassifyTable
45+universalTable :: ClassifyMap
46universalTable = concat [visibleChars, ctrlChars, ctrlMetaChars, specialSupportKeys]
46universalTable = concat [visibleChars, ctrlChars, ctrlMetaChars, specialSupportKeys]
48−capsClassifyTable :: Terminal -> [(String,Event)] -> ClassifyTable
48+capsClassifyMap :: Terminal -> [(String,Event)] -> ClassifyMap
49−capsClassifyTable terminal table = [(x,y) | (Just x,y) <- map extractCap table]
49+capsClassifyMap terminal table = [(x,y) | (Just x,y) <- map extractCap table]
50 where extractCap = first (getCapability terminal . tiGetStr)
50 where extractCap = first (getCapability terminal . tiGetStr)
52-- | tables specific to a given terminal that are not derivable from terminfo.
52-- | tables specific to a given terminal that are not derivable from terminfo.
54-- TODO: Adds the ANSI/VT100/VT50 tables regardless of term identifier.
54-- TODO: Adds the ANSI/VT100/VT50 tables regardless of term identifier.
55−termSpecificTables :: String -> [ClassifyTable]
55+termSpecificTables :: String -> [ClassifyMap]
56termSpecificTables _termName = ANSIVT.classifyTable
56termSpecificTables _termName = ANSIVT.classifyTable
58-- | Visible characters in the ISO-8859-1 and UTF-8 common set.
58-- | Visible characters in the ISO-8859-1 and UTF-8 common set.
@@ -62,7 +62,7 @@ termSpecificTables _termName = ANSIVT.classifyTable
63-- TODO: resolve
63-- TODO: resolve
64-- 1. start at ' '. The earlier characters are all 'ctrlChar'
64-- 1. start at ' '. The earlier characters are all 'ctrlChar'
65−visibleChars :: ClassifyTable
65+visibleChars :: ClassifyMap
66visibleChars = [ ([x], EvKey (KChar x) [])
66visibleChars = [ ([x], EvKey (KChar x) [])
67 | x <- [' ' .. toEnum 0xC1]
67 | x <- [' ' .. toEnum 0xC1]
@@ -70,7 +70,7 @@ visibleChars = [ ([x], EvKey (KChar x) [])
70-- | Non visible characters in the ISO-8859-1 and UTF-8 common set translated to ctrl + char.
70-- | Non visible characters in the ISO-8859-1 and UTF-8 common set translated to ctrl + char.
72-- \todo resolve CTRL-i is the same as tab
72-- \todo resolve CTRL-i is the same as tab
73−ctrlChars :: ClassifyTable
73+ctrlChars :: ClassifyMap
74ctrlChars =
74ctrlChars =
75 [ ([toEnum x],EvKey (KChar y) [MCtrl])
75 [ ([toEnum x],EvKey (KChar y) [MCtrl])
76 | (x,y) <- zip ([0..31]) ('@':['a'..'z']++['['..'_'])
76 | (x,y) <- zip ([0..31]) ('@':['a'..'z']++['['..'_'])
@@ -79,11 +79,11 @@ ctrlChars =
81-- | Ctrl+Meta+Char
81-- | Ctrl+Meta+Char
82−ctrlMetaChars :: ClassifyTable
82+ctrlMetaChars :: ClassifyMap
83ctrlMetaChars = map (\(s,EvKey c m) -> ('\ESC':s, EvKey c (MMeta:m))) ctrlChars
83ctrlMetaChars = map (\(s,EvKey c m) -> ('\ESC':s, EvKey c (MMeta:m))) ctrlChars
85-- | esc, meta esc, delete, meta delete, enter, meta enter
85-- | esc, meta esc, delete, meta delete, enter, meta enter
86−specialSupportKeys :: ClassifyTable
86+specialSupportKeys :: ClassifyMap
87specialSupportKeys =
87specialSupportKeys =
88 [ -- special support for ESC
88 [ -- special support for ESC
89 ("\ESC",EvKey KEsc []), ("\ESC\ESC",EvKey KEsc [MMeta])
89 ("\ESC",EvKey KEsc []), ("\ESC\ESC",EvKey KEsc [MMeta])
@@ -150,7 +150,7 @@ specialSupportKeys =
150-- * kRIT - shift right
150-- * kRIT - shift right
152-- * kcuu1 - up
152-- * kcuu1 - up
153−keysFromCapsTable :: ClassifyTable
153+keysFromCapsTable :: ClassifyMap
154keysFromCapsTable =
154keysFromCapsTable =
155 [ ("ka1", EvKey KUpLeft [])
155 [ ("ka1", EvKey KUpLeft [])
156 , ("ka3", EvKey KUpRight [])
156 , ("ka3", EvKey KUpRight [])
@@ -180,5 +180,5 @@ keysFromCapsTable =
180 ] ++ functionKeyCapsTable
180 ] ++ functionKeyCapsTable
182-- | cap names for function keys
182-- | cap names for function keys
183−functionKeyCapsTable :: ClassifyTable
183+functionKeyCapsTable :: ClassifyMap
184functionKeyCapsTable = flip map [0..63] $ \n -> ("kf" ++ show n, EvKey (KFun n) [])
184functionKeyCapsTable = flip map [0..63] $ \n -> ("kf" ++ show n, EvKey (KFun n) [])