@@ -1,27 +1,25 @@
11{-# LANGUAGE RecordWildCards #-}
22{-# LANGUAGE NamedFieldPuns #-}
3−-- | Output functions.
4−--
5−-- Access to the current terminal or a specific terminal device.
3+-- | This module provides functions for accessing the current terminal
4+-- or a specific terminal device.
65--
76-- See also:
87--
9−-- 1. "Graphics.Vty.Output": This instantiates an abtract interface to
10−-- the terminal interface based on the TERM and COLORTERM environment
8+-- 1. "Graphics.Vty.Output": This instantiates an abtract interface
9+-- to the terminal based on the @TERM@ and @COLORTERM@ environment
1110-- variables.
1211--
1312-- 2. "Graphics.Vty.Output.Interface": Defines the generic interface all
14−-- terminals need to implement.
13+-- terminal modules need to implement.
1514--
1615-- 3. "Graphics.Vty.Output.TerminfoBased": Defines a terminal instance
1716-- that uses terminfo for all control strings. No attempt is made to
18−-- change the character set to UTF-8 for these terminals. I don't know a
19−-- way to reliably determine if that is required or how to do so.
17+-- change the character set to UTF-8 for these terminals.
2018--
2119-- 4. "Graphics.Vty.Output.XTermColor": This module contains an
2220-- interface suitable for xterm-like terminals. These are the terminals
23−-- where TERM == xterm. This does use terminfo for as many control codes
24−-- as possible.
21+-- where @TERM@ begins with @xterm@. This does use terminfo for as many
22+-- control codes as possible.
2523module Graphics.Vty.Output
2624 ( outputForConfig
2725 , setCursorPos
@@ -45,17 +43,15 @@ import Control.Monad.Trans
4543import Data.List (isPrefixOf)
4644import Data.Monoid ((<>))
4745
48−-- | Returns a `Output` for the terminal specified in `Config`
46+-- | Returns an `Output` for the terminal specified in `Config`.
4947--
5048-- The specific Output implementation used is hidden from the API user.
5149-- All terminal implementations are assumed to perform more, or less,
5250-- the same. Currently, all implementations use terminfo for at least
5351-- some terminal specific information.
5452--
55−-- Specifics about it being based on terminfo are hidden from the API
56−-- user. If a terminal implementation is developed for a terminal
57−-- without terminfo support then Vty should work as expected on that
58−-- terminal.
53+-- If a terminal implementation is developed for a terminal without
54+-- terminfo support then Vty should work as expected on that terminal.
5955--
6056-- Selection of a terminal is done as follows:
6157--
@@ -87,7 +83,7 @@ outputForConfig config = (<> config) <$> standardIOConfig >>= outputForConfig
8783--
8884-- Currently, the only way to set the cursor position to a given
8985-- character coordinate is to specify the coordinate in the Picture
90−-- instance provided to outputPicture or refresh.
86+-- instance provided to 'outputPicture' or 'refresh'.
9187setCursorPos :: MonadIO m => Output -> Int -> Int -> m ()
9288setCursorPos t x y = do
9389 bounds <- displayBounds t
@@ -95,14 +91,14 @@ setCursorPos t x y = do
9591 dc <- displayContext t bounds
9692 liftIO $ outputByteBuffer t $ writeToByteString $ writeMoveCursor dc x y
9793
98−-- | Hides the cursor
94+-- | Hides the cursor.
9995hideCursor :: MonadIO m => Output -> m ()
10096hideCursor t = do
10197 bounds <- displayBounds t
10298 dc <- displayContext t bounds
10399 liftIO $ outputByteBuffer t $ writeToByteString $ writeHideCursor dc
104100
105−-- | Shows the cursor
101+-- | Shows the cursor.
106102showCursor :: MonadIO m => Output -> m ()
107103showCursor t = do
108104 bounds <- displayBounds t