@@ -1,14 +1,31 @@
11-- | Vty supports input and output to terminal devices.
22--
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.
44--
55-- - 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
7−-- "Graphics.Vty.Image" provides a number of constructor equations that will build correct
8−-- 'Image' values. See 'string', '<|>', and '<->' for starters.
6+--
7+-- - The module "Graphics.Vty.Image" provides a number of constructor equations that will build
8+-- correct 'Image' values. See 'string', '<|>', and '<->' for starters.
9+--
10+-- - The constructors in "Graphics.Vty.Image.Internal" should not be used.
911--
1012-- - 'Image's can be styled using 'Attr'. See "Graphics.Vty.Attributes".
1113--
14+-- See the vty-examples package for a number of examples.
15+--
16+-- @
17+-- main = do
18+-- vty <- 'mkVty' def
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
23+-- 'update' vty pic
24+-- e :: 'Event' <- 'nextEvent' vty
25+-- 'shutdown' vty
26+-- print $ \"Last event was: \" ++ show e
27+-- @
28+--
1229-- Good sources of documentation for terminal programming are:
1330--
1431-- - <https://github.com/b4winckler/vim/blob/master/src/term.c>
@@ -24,6 +41,7 @@
2441-- - <http://vt100.net/docs/vt100-ug/chapter3.html vt100 control sequences>
2542module Graphics.Vty ( Vty(..)
2643 , mkVty
44+ , module Graphics.Vty.Config
2745 , module Graphics.Vty.Input
2846 , module Graphics.Vty.Output
2947 , module Graphics.Vty.Picture
@@ -72,9 +90,9 @@ data Vty = Vty
7290 , inputIface :: Input
7391 -- | The output interface. See 'Output'
7492 , outputIface :: Output
75− -- | Refresh the display. Normally the library takes care of refreshing. Nonetheless, some
76− -- other program might output to the terminal and mess up the display. In that case the
77− -- application might want to force a refresh.
93+ -- | Refresh the display. 'nextEvent' will refresh the display if a resize occurs.
94+ -- If other programs output to the terminal and mess up the display then the application might
95+ -- want to force a refresh.
7896 , refresh :: IO ()
7997 -- | Clean up after vty.
8098 -- The above methods will throw an exception if executed after this is executed.
@@ -82,12 +100,12 @@ data Vty = Vty
82100 }
83101
84102-- | 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.
86104--
87105-- The specified config is added to the 'userConfig'. With the 'userConfig' taking precedence.
88106-- See "Graphics.Vty.Config"
89107--
90−-- For most applications `mkVty def` is sufficient.
108+-- For most applications @mkVty def@ is sufficient.
91109mkVty :: Config -> IO Vty
92110mkVty appConfig = do
93111 config <- mappend <$> pure appConfig <*> userConfig