@@ -1,14 +1,31 @@
1-- | Vty supports input and output to terminal devices.
1-- | Vty supports input and output to terminal devices.
3−-- - The input is provides as a sequence of 'Event's.
3+-- - Input to the terminal is provided to the app as a sequence of 'Event's.
5-- - The output is defined by a 'Picture'. Which is one or more layers of 'Image's.
5-- - The output is defined by a 'Picture'. Which is one or more layers of 'Image's.
6−-- The constructors in "Graphics.Vty.Image.Internal" should not be used directly. The module
6+--
7−-- "Graphics.Vty.Image" provides a number of constructor equations that will build correct
7+-- - The module "Graphics.Vty.Image" provides a number of constructor equations that will build
8−-- 'Image' values. See 'string', '<|>', and '<->' for starters.
8+-- correct 'Image' values. See 'string', '<|>', and '<->' for starters.
10+-- - The constructors in "Graphics.Vty.Image.Internal" should not be used.
10-- - 'Image's can be styled using 'Attr'. See "Graphics.Vty.Attributes".
12-- - 'Image's can be styled using 'Attr'. See "Graphics.Vty.Attributes".
14+-- See the vty-examples package for a number of examples.
19+-- let line0 = 'string' (def `withForeColor` 'green') \"first line\"
20+-- line1 = 'string' (def `withBackColor` 'blue') \"second line\"
21+-- img = line0 '<->' line1
22+-- pic = 'picForImage' img
24+-- e :: 'Event' <- 'nextEvent' vty
26+-- print $ \"Last event was: \" ++ show e
12-- Good sources of documentation for terminal programming are:
29-- Good sources of documentation for terminal programming are:
14-- - <https://github.com/b4winckler/vim/blob/master/src/term.c>
31-- - <https://github.com/b4winckler/vim/blob/master/src/term.c>
@@ -24,6 +41,7 @@
24-- - <http://vt100.net/docs/vt100-ug/chapter3.html vt100 control sequences>
41-- - <http://vt100.net/docs/vt100-ug/chapter3.html vt100 control sequences>
25module Graphics.Vty ( Vty(..)
42module Graphics.Vty ( Vty(..)
44+ , module Graphics.Vty.Config
27 , module Graphics.Vty.Input
45 , module Graphics.Vty.Input
28 , module Graphics.Vty.Output
46 , module Graphics.Vty.Output
29 , module Graphics.Vty.Picture
47 , module Graphics.Vty.Picture
@@ -72,9 +90,9 @@ data Vty = Vty
72 , inputIface :: Input
90 , inputIface :: Input
73 -- | The output interface. See 'Output'
91 -- | The output interface. See 'Output'
74 , outputIface :: Output
92 , outputIface :: Output
75− -- | Refresh the display. Normally the library takes care of refreshing. Nonetheless, some
93+ -- | Refresh the display. 'nextEvent' will refresh the display if a resize occurs.
76− -- other program might output to the terminal and mess up the display. In that case the
94+ -- If other programs output to the terminal and mess up the display then the application might
77− -- application might want to force a refresh.
95+ -- want to force a refresh.
78 , refresh :: IO ()
96 , refresh :: IO ()
79 -- | Clean up after vty.
97 -- | Clean up after vty.
80 -- The above methods will throw an exception if executed after this is executed.
98 -- The above methods will throw an exception if executed after this is executed.
@@ -82,12 +100,12 @@ data Vty = Vty
84-- | Set up the state object for using vty. At most one state object should be
102-- | Set up the state object for using vty. At most one state object should be
85−-- created at a time.
103+-- created at a time for a given terminal device.
87-- The specified config is added to the 'userConfig'. With the 'userConfig' taking precedence.
105-- The specified config is added to the 'userConfig'. With the 'userConfig' taking precedence.
88-- See "Graphics.Vty.Config"
106-- See "Graphics.Vty.Config"
90−-- For most applications `mkVty def` is sufficient.
108+-- For most applications @mkVty def@ is sufficient.
91mkVty :: Config -> IO Vty
109mkVty :: Config -> IO Vty
92mkVty appConfig = do
110mkVty appConfig = do
93 config <- mappend <$> pure appConfig <*> userConfig
111 config <- mappend <$> pure appConfig <*> userConfig