Portability | portable (FFI) |
---|---|
Stability | experimental |
Maintainer | judah.jacobson@gmail.com |
This module provides a low-level interface to the C functions of the terminfo library.
NOTE: Since this library is built on top of the curses interface, it is not thread-safe.
- data Terminal
- setupTerm :: String -> IO Terminal
- setupTermFromEnv :: IO Terminal
- data Capability a
- getCapability :: Terminal -> Capability a -> Maybe a
- tiGetFlag :: String -> Capability Bool
- tiGuardFlag :: String -> Capability ()
- tiGetNum :: String -> Capability Int
- tiGetStr :: String -> Capability String
- data TermOutput
- runTermOutput :: Terminal -> TermOutput -> IO ()
- termText :: String -> TermOutput
- tiGetOutput :: String -> Capability ([Int] -> LinesAffected -> TermOutput)
- type LinesAffected = Int
- tiGetOutput1 :: OutputCap f => String -> Capability f
- class OutputCap f
- module Data.Monoid
Documentation
setupTerm :: String -> IO TerminalSource
Initialize the terminfo library to the given terminal entry.
setupTermFromEnv :: IO TerminalSource
Initialize the terminfo library, using the TERM
environmental variable.
If TERM
is not set, we use the generic, minimal entry dumb
.
data Capability a Source
A feature or operation which a Terminal
may define.
getCapability :: Terminal -> Capability a -> Maybe aSource
tiGetFlag :: String -> Capability BoolSource
Look up a boolean capability in the terminfo database.
Unlike tiGuardFlag
, this capability never fails; it returns False
if the
capability is absent or set to false, and returns True
otherwise.
tiGuardFlag :: String -> Capability ()Source
Look up a boolean capability in the terminfo database, and fail if it's not defined.
tiGetNum :: String -> Capability IntSource
Look up a numeric capability in the terminfo database.
tiGetStr :: String -> Capability StringSource
Look up a string capability in the terminfo database.
Note: Do not use this function for terminal output; use tiGetOutput
instead.
data TermOutput Source
An action which sends output to the terminal. That output may mix plain text with control characters and escape sequences, along with delays (called "padding") required by some older terminals.
runTermOutput :: Terminal -> TermOutput -> IO ()Source
termText :: String -> TermOutputSource
Output plain text containing no control characters or escape sequences.
tiGetOutput :: String -> Capability ([Int] -> LinesAffected -> TermOutput)Source
Look up an output capability in the terminfo database.
type LinesAffected = IntSource
A parameter to specify the number of lines affected. Some capabilities
(e.g., clear
and dch1
) use
this parameter on some terminals to compute variable-length padding.
tiGetOutput1 :: OutputCap f => String -> Capability fSource
Look up an output capability which takes a fixed number of parameters
(for example, Int -> Int -> TermOutput
).
For capabilities which may contain variable-length
padding, use tiGetOutput
instead.
A type class to encapsulate capabilities which take in zero or more parameters.
OutputCap TermOutput | |
(Enum a, OutputCap f) => OutputCap (a -> f) |
module Data.Monoid