Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module provides an abstract interface for performing terminal output and functions for accessing the current terminal or a specific terminal device.
Synopsis
- data Output = Output {
- terminalID :: String
- releaseTerminal :: IO ()
- reserveDisplay :: IO ()
- releaseDisplay :: IO ()
- setDisplayBounds :: (Int, Int) -> IO ()
- displayBounds :: IO DisplayRegion
- outputByteBuffer :: ByteString -> IO ()
- supportsCursorVisibility :: Bool
- supportsMode :: Mode -> Bool
- setMode :: Mode -> Bool -> IO ()
- getModeStatus :: Mode -> IO Bool
- assumedStateRef :: IORef AssumedState
- mkDisplayContext :: Output -> DisplayRegion -> IO DisplayContext
- ringTerminalBell :: IO ()
- supportsBell :: IO Bool
- supportsItalics :: IO Bool
- supportsStrikethrough :: IO Bool
- outputColorMode :: ColorMode
- setOutputWindowTitle :: String -> IO ()
- data AssumedState = AssumedState {}
- data DisplayContext = DisplayContext {
- contextDevice :: Output
- contextRegion :: DisplayRegion
- writeMoveCursor :: Int -> Int -> Write
- writeShowCursor :: Write
- writeHideCursor :: Write
- writeSetAttr :: Bool -> FixedAttr -> Attr -> DisplayAttrDiff -> Write
- writeDefaultAttr :: Bool -> Write
- writeRowEnd :: Write
- inlineHack :: IO ()
- data Mode
- displayContext :: Output -> DisplayRegion -> IO DisplayContext
- outputPicture :: DisplayContext -> Picture -> IO ()
- initialAssumedState :: AssumedState
- limitAttrForDisplay :: Output -> Attr -> Attr
- setCursorPos :: Output -> Int -> Int -> IO ()
- hideCursor :: Output -> IO ()
- showCursor :: Output -> IO ()
Documentation
The library's device output abstraction. Platform-specific
implementations must implement an Output
and provide it to
mkVtyFromPair
.
Output | |
|
data AssumedState Source #
data DisplayContext Source #
DisplayContext | |
|
Modal terminal features that can be enabled and disabled.
Mouse | Mouse mode (whether the terminal is configured to provide mouse input events) |
BracketedPaste | Paste mode (whether the terminal is configured to provide events on OS pastes) |
Focus | Focus-in/focus-out events (whether the terminal is configured to provide events on focus change) |
Hyperlink | Hyperlink mode via the |
displayContext :: Output -> DisplayRegion -> IO DisplayContext Source #
outputPicture :: DisplayContext -> Picture -> IO () Source #
Displays the given Picture
.
- The image is cropped to the display size.
- Converted into a sequence of attribute changes and text spans.
- The cursor is hidden.
- Serialized to the display.
- The cursor is then shown and positioned or kept hidden.
limitAttrForDisplay :: Output -> Attr -> Attr Source #
Not all terminals support all display attributes. This filters a display attribute to what the given terminal can display.
setCursorPos :: Output -> Int -> Int -> IO () Source #
Sets the cursor position to the given output column and row.
This is not necessarily the same as the character position with the same coordinates. Characters can be a variable number of columns in width.
Currently, the only way to set the cursor position to a given
character coordinate is to specify the coordinate in the Picture
instance provided to outputPicture
or refresh
.
hideCursor :: Output -> IO () Source #
Hides the cursor.
showCursor :: Output -> IO () Source #
Shows the cursor.