@@ -1,6 +1,5 @@
1{-# LANGUAGE RecordWildCards #-}
1{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE NamedFieldPuns #-}
2{-# LANGUAGE NamedFieldPuns #-}
4-- | Output interface.
3-- | Output interface.
6-- Access to the current terminal or a specific terminal device.
5-- Access to the current terminal or a specific terminal device.
@@ -8,8 +7,8 @@
8-- See also:
7-- See also:
10-- 1. "Graphics.Vty.Output": This instantiates an abtract interface to the terminal interface based
9-- 1. "Graphics.Vty.Output": This instantiates an abtract interface to the terminal interface based
11−-- on the TERM and COLORTERM environment variables.
10+-- on the TERM and COLORTERM environment variables.
13-- 2. "Graphics.Vty.Output.Interface": Defines the generic interface all terminals need to implement.
12-- 2. "Graphics.Vty.Output.Interface": Defines the generic interface all terminals need to implement.
15-- 3. "Graphics.Vty.Output.TerminfoBased": Defines a terminal instance that uses terminfo for all
14-- 3. "Graphics.Vty.Output.TerminfoBased": Defines a terminal instance that uses terminfo for all
@@ -18,7 +17,7 @@
19-- 4. "Graphics.Vty.Output.XTermColor": This module contains an interface suitable for xterm-like
18-- 4. "Graphics.Vty.Output.XTermColor": This module contains an interface suitable for xterm-like
20-- terminals. These are the terminals where TERM == xterm. This does use terminfo for as many
19-- terminals. These are the terminals where TERM == xterm. This does use terminfo for as many
21−-- control codes as possible.
20+-- control codes as possible.
22module Graphics.Vty.Output ( module Graphics.Vty.Output
21module Graphics.Vty.Output ( module Graphics.Vty.Output
23 , Output(..) -- \todo hide constructors
22 , Output(..) -- \todo hide constructors
24 , AssumedState(..)
23 , AssumedState(..)
@@ -28,7 +27,6 @@ module Graphics.Vty.Output ( module Graphics.Vty.Output
32import Graphics.Vty.Prelude
30import Graphics.Vty.Prelude
34import Graphics.Vty.Config
32import Graphics.Vty.Config
@@ -70,7 +68,7 @@ outputForConfig Config{ outputFd = Just fd, termName = Just termName, .. } = do
71outputForConfig config = (<> config) <$> standardIOConfig >>= outputForConfig
69outputForConfig config = (<> config) <$> standardIOConfig >>= outputForConfig
73−-- | Sets the cursor position to the given output column and row.
71+-- | Sets the cursor position to the given output column and row.
75-- This is not necessarially the same as the character position with the same coordinates.
73-- This is not necessarially the same as the character position with the same coordinates.
76-- Characters can be a variable number of columns in width.
74-- Characters can be a variable number of columns in width.
@@ -90,11 +88,10 @@ hideCursor t = do
90 bounds <- displayBounds t
88 bounds <- displayBounds t
91 dc <- displayContext t bounds
89 dc <- displayContext t bounds
92 liftIO $ outputByteBuffer t $ writeToByteString $ writeHideCursor dc
90 liftIO $ outputByteBuffer t $ writeToByteString $ writeHideCursor dc
94-- | Shows the cursor
92-- | Shows the cursor
95showCursor :: MonadIO m => Output -> m ()
93showCursor :: MonadIO m => Output -> m ()
96showCursor t = do
94showCursor t = do
97 bounds <- displayBounds t
95 bounds <- displayBounds t
98 dc <- displayContext t bounds
96 dc <- displayContext t bounds
99 liftIO $ outputByteBuffer t $ writeToByteString $ writeShowCursor dc
97 liftIO $ outputByteBuffer t $ writeToByteString $ writeShowCursor dc