@@ -1,5 +1,7 @@
1-- Copyright 2009-2010 Corey O'Connor
1-- Copyright 2009-2010 Corey O'Connor
3+-- Right, I'm mostly guessing on these details. So, as far as I can figure:
3-- There are two input modes:
5-- There are two input modes:
@@ -45,10 +47,33 @@ defaultEscDelay = 4000
46-- | Set up the terminal for input. Returns a function which reads key
48-- | Set up the terminal for input. Returns a function which reads key
47-- events, and a function for shutting down the terminal access.
49-- events, and a function for shutting down the terminal access.
51+-- The terminal is modified as follows:
54+-- - disables software flow control on outgoing data. This stops the process from being
55+-- suspended if the output terminal cannot keep up. I presume this has little effect these
56+-- days. I hope this means that output will be buffered if the terminal cannot keep up. In the
57+-- ol days the output might of been dropped.
59+-- "raw" mode is used for input.
62+-- - enables keyboard combinations that result in signals. People would probably want this to
66+-- - input is not echod to the output.
69+-- - canonical mode (line mode) input is not used.
72+-- - extended functions are disabled. Uh. Whatever these are.
48initTermInput :: Int -> Terminal -> IO (IO Event, IO ())
74initTermInput :: Int -> Terminal -> IO (IO Event, IO ())
49initTermInput escDelay terminal = do
75initTermInput escDelay terminal = do
50 attr <- getTerminalAttributes stdInput
76 attr <- getTerminalAttributes stdInput
52 let attr' = foldl withoutMode attr [ StartStopOutput, KeyboardInterrupts
77 let attr' = foldl withoutMode attr [ StartStopOutput, KeyboardInterrupts
53 , EnableEcho, ProcessInput, ExtendedFunctions
78 , EnableEcho, ProcessInput, ExtendedFunctions