@@ -27,15 +27,17 @@ data Event = EvKey Key [Modifier] | EvMouse Int Int Button [Modifier]
2727-- | representation of mapping from input bytes to output event
2828--
2929-- deprecated
30−type ClassifyTable = [(String, (Key, [Modifier]))]
30+type ClassifyTableV1 = [(String, (Key, [Modifier]))]
3131
32−map_to_legacy_table :: [(String, Event)] -> ClassifyTable
32+type ClassifyTable = [(String, Event)]
33+
34+map_to_legacy_table :: ClassifyTable -> ClassifyTableV1
3335map_to_legacy_table = map f
3436 where f (s, EvKey k mods) = (s, (k, mods))
3537 f _ = error "no mapping for mouse or resize events"
3638
3739-- | classify table directly generated from terminfo cap strings
38−keys_from_caps_table :: [(String, Event)]
40+keys_from_caps_table :: ClassifyTable
3941keys_from_caps_table =
4042 [ ("khome", EvKey KHome [])
4143 , ("kend", EvKey KEnd [])
@@ -49,13 +51,13 @@ keys_from_caps_table =
4951 ] ++ function_key_caps_table
5052
5153-- | cap names for function keys
52−function_key_caps_table :: [(String, Event)]
54+function_key_caps_table :: ClassifyTable
5355function_key_caps_table = flip map [0..63] $ \n -> ("kf" ++ show n, EvKey (KFun n) [])
5456
55−-- VT 100 encoding for navigation keys.
57+-- | Encoding for navigation keys.
5658--
57−-- TODO: remove those that duplicate entries in caps table.
58−nav_keys_0 :: ClassifyTable
59+-- TODO: This is not the same as the input bytes pulled from teh caps table.
60+nav_keys_0 :: ClassifyTableV1
5961nav_keys_0 =
6062 [ k "G" KNP5
6163 , k "P" KPause
@@ -69,8 +71,8 @@ nav_keys_0 =
6971 ]
7072 where k c s = ("\ESC["++c,(s,[]))
7173
72−-- | VT 100 (?) encoding for arrows and KHome/KEnd
73−nav_keys_1 :: ClassifyTable
74+-- | VT 100 (?) encoding for shift, meta and ctrl plus arrows/home/end
75+nav_keys_1 :: ClassifyTableV1
7476nav_keys_1 =
7577 [("\ESC[" ++ charCnt ++ show mc++c,(s,m))
7678 | charCnt <- ["1;", ""], -- we can have a count or not
@@ -105,9 +107,6 @@ simple_chars = [(x:[],(KASCII x,[])) | x <- [' ' .. toEnum 0xC1]]
105107
106108-- | VT 100 (?) encoding for shift plus function keys
107109--
108−-- (corey): yes. This definitely should. On my terminal these keys do not operate as expected.
109−-- function_keys_0 :: ClassifyTable
110−-- function_keys_0 = [ ("\ESC[["++[toEnum(64+i)],(KFun i,[])) | i <- [1..5] ]
111110-- TODO: I suspect this should be generated by interpretting the terminals use of meta mode:
112111-- "If the terminal has a ``meta key'' which acts as a shift key, setting the 8th bit of any
113112-- character transmitted, this fact can be indicated with km. Other- wise, software will