on master help sign in
inputForConfig: move mode flag documentation to the right place and update it to include enabled flags
commit95cabe0b874944a2c51ad0eaff77f7cc7c3d30e6 authorJonathan Daugherty <cygnus@foobox.com> dateThu 9 Jul 2020, 14:05 (6 years ago) parentc572ad1
2 files changed+27−16
src/Graphics/Vty/Input.hs+2−16 src/Graphics/Vty/Input/Loop.hs+25
src/Graphics/Vty/Input.hs+2−16
@@ -143,22 +143,8 @@ import Data.Monoid ((<>))
143143-- bytes comes from 'classifyMapForTerm' which is then overridden by
144144-- the the applicable entries from the configuration's 'inputMap'.
145145--
146−-- The terminal device is configured with the attributes:
147−--
148−-- * IXON disabled: disables software flow control on outgoing data.
149−-- This stops the process from being suspended if the output terminal
150−-- cannot keep up.
151−--
152−-- * Raw mode is used for input.
153−--
154−-- * ISIG disabled (enables keyboard combinations that result in
155−-- signals)
156−--
157−-- * ECHO disabled (input is not echoed to the output)
158−--
159−-- * ICANON disabled (canonical mode (line mode) input is not used)
160−--
161−-- * IEXTEN disabled (extended functions are disabled)
146+-- The terminal device's mode flags are configured by the
147+-- 'attributeControl' function.
162148inputForConfig :: Config -> IO Input
163149inputForConfig config@Config{ termName = Just termName
164150 , inputFd = Just termFd
src/Graphics/Vty/Input/Loop.hs+25
@@ -171,6 +171,31 @@ runInputProcessorLoop classifyTable input = do
171171 <*> pure (classify classifyTable)
172172 runReaderT (evalStateT loopInputProcessor s0) input
173173
174+-- | Construct two IO actions: one to configure the terminal for Vty and
175+-- one to restore the terminal mode flags to the values they had at the
176+-- time this function was called.
177+--
178+-- This function constructs a configuration action to clear the
179+-- following terminal mode flags:
180+--
181+-- * IXON disabled: disables software flow control on outgoing data.
182+-- This stops the process from being suspended if the output terminal
183+-- cannot keep up.
184+--
185+-- * Raw mode is used for input.
186+--
187+-- * ISIG (enables keyboard combinations that result in
188+-- signals)
189+--
190+-- * ECHO (input is not echoed to the output)
191+--
192+-- * ICANON (canonical mode (line mode) input is not used)
193+--
194+-- * IEXTEN (extended functions are disabled)
195+--
196+-- The configuration actual also explicitly sets these flags:
197+--
198+-- * ICRNL (input carriage returns are mapped to newlines)
174199attributeControl :: Fd -> IO (IO (), IO ())
175200attributeControl fd = do
176201 original <- getTerminalAttributes fd