2
-- Maintainer : judah.jacobson@gmail.com
3
-- Stability : experimental
4
-- Portability : portable (FFI)
6
-- The string capabilities in this module are the character sequences
7
-- corresponding to user input such as arrow keys and function keys.
8
module System.Console.Terminfo.Keys(
10
-- | The following commands
11
-- turn the keypad on\/off (@smkx@ and @rmkx@).
12
-- They have no effect if those capabilities are not defined.
13
-- For portability between terminals, the keypad should be
14
-- explicitly turned on before accepting user key input.
33
import System.Console.Terminfo.Base
35
keypadOn :: TermStr s => Capability s
36
keypadOn = tiGetOutput1 "smkx"
38
keypadOff :: TermStr s => Capability s
39
keypadOff = tiGetOutput1 "rmkx"
41
keyUp :: Capability String
42
keyUp = tiGetOutput1 "kcuu1"
44
keyDown :: Capability String
45
keyDown = tiGetOutput1 "kcud1"
47
keyLeft :: Capability String
48
keyLeft = tiGetOutput1 "kcub1"
50
keyRight :: Capability String
51
keyRight = tiGetOutput1 "kcuf1"
53
-- | Look up the control sequence for a given function sequence. For example,
54
-- @functionKey 12@ retrieves the @kf12@ capability.
55
functionKey :: Int -> Capability String
56
functionKey n = tiGetOutput1 ("kf" ++ show n)
58
keyBackspace :: Capability String
59
keyBackspace = tiGetOutput1 "kbs"
61
keyDeleteChar :: Capability String
62
keyDeleteChar = tiGetOutput1 "kdch1"
64
keyHome :: Capability String
65
keyHome = tiGetOutput1 "khome"
67
keyEnd :: Capability String
68
keyEnd = tiGetOutput1 "kend"
70
keyPageUp :: Capability String
71
keyPageUp = tiGetOutput1 "kpp"
73
keyPageDown :: Capability String
74
keyPageDown = tiGetOutput1 "knp"
76
keyEnter :: Capability String
77
keyEnter = tiGetOutput1 "kent"