on master help sign in
rename DisplayRegion module to Prelude
4e45d7cCorey O'Connor
CHANGELOG+1
@@ -1,6 +1,7 @@
15.0.0
15.0.0
2 * removed the typeclass based terminal and display context interface in favor of a data
2 * removed the typeclass based terminal and display context interface in favor of a data
3 structure of properties interface.
3 structure of properties interface.
4+ * renamed the Terminal interface to Output
4 * The default picture for an image now uses the "clear" background. This background fills
5 * The default picture for an image now uses the "clear" background. This background fills
5 background spans with spaces or just ends the line.
6 background spans with spaces or just ends the line.
6 * Previously the background defaulted to the space character. This causes issues copying
7 * Previously the background defaulted to the space character. This causes issues copying
README.md−8
@@ -76,11 +76,3 @@ rm -rf dist ; cabal configure --enable-tests --disable-library-coverage \
76 --enable-library-profiling \
76 --enable-library-profiling \
77 --enable-executable-profiling
77 --enable-executable-profiling
78~~~
78~~~
79−
80−# References
81−
82−* https://github.com/b4winckler/vim/blob/master/src/term.c
83−* http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
84−* http://ulisse.elettra.trieste.it/services/doc/serial/config.html
85−* http://www.leonerd.org.uk/hacks/hints/xterm-8bit.html
86−* http://www.unixwiz.net/techtips/termios-vmin-vtime.html
src/Graphics/Vty.hs+23−24
@@ -1,17 +1,22 @@
1−-- Copyright 2009-2010 Corey O'Connor
1+-- | Vty supports input and output to terminal devices. The input is provides as a sequence of
2−{-# LANGUAGE ForeignFunctionInterface, BangPatterns, UnboxedTuples #-}
2+-- 'Event's. The output is defined by a 'Picture'. Which is one or more layers of 'Image's.
3−{-# CFILES gwinsz.c #-}
3+--
4−
4+-- - References
5+--
5-- Good sources of documentation for terminal programming are:
6-- Good sources of documentation for terminal programming are:
7+--
8+-- - <https://github.com/b4winckler/vim/blob/master/src/term.c>
9+-- - <http://invisible-island.net/xterm/ctlseqs/ctlseqs.html>
10+-- - <http://ulisse.elettra.trieste.it/services/doc/serial/config.html>
11+-- - <http://www.leonerd.org.uk/hacks/hints/xterm-8bit.html>
12+-- - <http://www.unixwiz.net/techtips/termios-vmin-vtime.html>
6−-- vt100 control sequences: http://vt100.net/docs/vt100-ug/chapter3.html#S3.3.3
13+-- - <<http://vt100.net/docs/vt100-ug/chapter3.html vt100 control sequences>
7−-- Xterm control sequences: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
8−
9module Graphics.Vty ( Vty(..)
14module Graphics.Vty ( Vty(..)
10 , mkVty
15 , mkVty
11 , mkVtyEscDelay
16 , mkVtyEscDelay
12− , module Graphics.Vty.Terminal
17+ , module Graphics.Vty.Output
13 , module Graphics.Vty.Picture
18 , module Graphics.Vty.Picture
14− , module Graphics.Vty.DisplayRegion
19+ , DisplayRegion
15 , Key(..)
20 , Key(..)
16 , Modifier(..)
21 , Modifier(..)
17 , Button(..)
22 , Button(..)
@@ -19,11 +24,11 @@ module Graphics.Vty ( Vty(..)
19 )
24 )
20 where
25 where
21
26
27+import Graphics.Vty.Prelude
22
28
23−import Graphics.Vty.Terminal
24−import Graphics.Vty.Picture
25−import Graphics.Vty.DisplayRegion
26import Graphics.Vty.Input
29import Graphics.Vty.Input
30+import Graphics.Vty.Output
31+import Graphics.Vty.Picture
27
32
28import Data.IORef
33import Data.IORef
29
34
@@ -35,9 +40,6 @@ import qualified System.Console.Terminfo as Terminfo
35--
40--
36-- This does not assure any thread safety. In theory, as long as an update action is not executed
41-- This does not assure any thread safety. In theory, as long as an update action is not executed
37-- when another update action is already then it's safe to call this on multiple threads.
42-- when another update action is already then it's safe to call this on multiple threads.
38−--
39−-- todo: Once the Terminal interface encompasses input this interface will be deprecated.
40−-- Currently, just using the Terminal interface there is no support for input events.
41data Vty = Vty
43data Vty = Vty
42 { -- | Outputs the given Picture. Equivalent to output_picture applied to a display context
44 { -- | Outputs the given Picture. Equivalent to output_picture applied to a display context
43 -- implicitly managed by Vty.
45 -- implicitly managed by Vty.
@@ -56,11 +58,11 @@ data Vty = Vty
56 --
58 --
57 -- 3. shutdown vty.
59 -- 3. shutdown vty.
58 --
60 --
59− -- todo: provide a similar abstraction to Graphics.Vty.Terminal for input. Use haskeline's
61+ -- todo: provide a similar abstraction to Graphics.Vty.Output for input. Use haskeline's
60 -- input backend for implementation.
62 -- input backend for implementation.
61 --
63 --
62 -- todo: remove explicit `shutdown` requirement.
64 -- todo: remove explicit `shutdown` requirement.
63− , terminal :: Terminal
65+ , terminal :: Output
64 -- | Refresh the display. Normally the library takes care of refreshing. Nonetheless, some
66 -- | Refresh the display. Normally the library takes care of refreshing. Nonetheless, some
65 -- other program might output to the terminal and mess the display. In that case the user
67 -- other program might output to the terminal and mess the display. In that case the user
66 -- might want to force a refresh.
68 -- might want to force a refresh.
@@ -87,15 +89,14 @@ mkVtyEscDelay escDelay = do
87 (kvar, endi) <- initTermInput escDelay term_info
89 (kvar, endi) <- initTermInput escDelay term_info
88 intMkVty kvar ( endi >> release_display t >> release_terminal t ) t
90 intMkVty kvar ( endi >> release_display t >> release_terminal t ) t
89
91
90−intMkVty :: IO Event -> IO () -> Terminal -> IO Vty
92+intMkVty :: IO Event -> IO () -> Output -> IO Vty
91intMkVty kvar fend t = do
93intMkVty kvar fend t = do
92 last_pic_ref <- newIORef Nothing
94 last_pic_ref <- newIORef Nothing
93 last_update_ref <- newIORef Nothing
95 last_update_ref <- newIORef Nothing
94
96
95 let inner_update in_pic = do
97 let inner_update in_pic = do
96− b <- display_bounds t
98+ b@(w,h) <- display_bounds t
97− let DisplayRegion w h = b
98− cursor = pic_cursor in_pic
99+ let cursor = pic_cursor in_pic
99 in_pic' = case cursor of
100 in_pic' = case cursor of
100 Cursor x y ->
101 Cursor x y ->
101 let
102 let
@@ -136,9 +137,7 @@ intMkVty kvar fend t = do
136 case k of
137 case k of
137 (EvResize _ _) -> inner_refresh
138 (EvResize _ _) -> inner_refresh
138 >> display_bounds t
139 >> display_bounds t
139− >>= return . ( \(DisplayRegion w h)
140− -> EvResize (fromEnum w) (fromEnum h)
140+ >>= return . (\(w,h)-> EvResize w h)
141− )
142 _ -> return k
141 _ -> return k
143
142
144 return $ Vty { update = inner_update
143 return $ Vty { update = inner_update
src/Graphics/Vty/Debug.hs+3−2
@@ -4,10 +4,11 @@ module Graphics.Vty.Debug ( module Graphics.Vty.Debug
4 )
4 )
5where
5where
6
6
7+import Graphics.Vty.Prelude
8+
7import Graphics.Vty.Attributes
9import Graphics.Vty.Attributes
8import Graphics.Vty.Debug.Image
10import Graphics.Vty.Debug.Image
9import Graphics.Vty.Span
11import Graphics.Vty.Span
10−import Graphics.Vty.DisplayRegion
11
12
12import qualified Data.Vector as Vector
13import qualified Data.Vector as Vector
13
14
@@ -35,5 +36,5 @@ data MockWindow = MockWindow Int Int
35 deriving (Show, Eq)
36 deriving (Show, Eq)
36
37
37region_for_window :: MockWindow -> DisplayRegion
38region_for_window :: MockWindow -> DisplayRegion
38−region_for_window (MockWindow w h) = DisplayRegion w h
39+region_for_window (MockWindow w h) = (w,h)
39
40
src/Graphics/Vty/DisplayRegion.hsdeleted−10
@@ -1,10 +0,0 @@
1−-- Copyright 2009 Corey O'Connor
2−module Graphics.Vty.DisplayRegion
3− where
4−
5−-- | Region of the terminal that vty will output to. Units are columns not characters.
6−data DisplayRegion = DisplayRegion
7− { region_width :: !Int
8− , region_height :: !Int
9− } deriving ( Show, Eq )
10−
src/Graphics/Vty/Inline.hs+2−2
@@ -33,7 +33,7 @@ module Graphics.Vty.Inline ( module Graphics.Vty.Inline
33import Graphics.Vty
33import Graphics.Vty
34import Graphics.Vty.DisplayAttributes
34import Graphics.Vty.DisplayAttributes
35import Graphics.Vty.Inline.Unsafe
35import Graphics.Vty.Inline.Unsafe
36−import Graphics.Vty.Terminal.Interface
36+import Graphics.Vty.Output.Interface
37
37
38import Control.Applicative
38import Control.Applicative
39import Control.Monad.State.Strict
39import Control.Monad.State.Strict
@@ -79,7 +79,7 @@ default_all = put def_attr
79-- | Apply the provided display attribute changes to the given terminal.
79-- | Apply the provided display attribute changes to the given terminal.
80--
80--
81-- This does not flush the terminal.
81-- This does not flush the terminal.
82−put_attr_change :: ( Applicative m, MonadIO m ) => Terminal -> InlineM () -> m ()
82+put_attr_change :: ( Applicative m, MonadIO m ) => Output -> InlineM () -> m ()
83put_attr_change t c = liftIO $ do
83put_attr_change t c = liftIO $ do
84 bounds <- display_bounds t
84 bounds <- display_bounds t
85 dc <- display_context t bounds
85 dc <- display_context t bounds
src/Graphics/Vty/Input.hs+5−5
@@ -56,19 +56,19 @@ defaultEscDelay = 10000
56-- - disables software flow control on outgoing data. This stops the process from being
56-- - disables software flow control on outgoing data. This stops the process from being
57-- suspended if the output terminal cannot keep up. I presume this has little effect these
57-- suspended if the output terminal cannot keep up. I presume this has little effect these
58-- days. I hope this means that output will be buffered if the terminal cannot keep up. In the
58-- days. I hope this means that output will be buffered if the terminal cannot keep up. In the
59−-- ol days the output might of been dropped.
59+-- old days the output might of been dropped.
60--
60--
61-- "raw" mode is used for input.
61-- "raw" mode is used for input.
62--
62--
63-- * ISIG disabled
63-- * ISIG disabled
64−-- - enables keyboard combinations that result in signals. People would probably want this to
64+-- - enables keyboard combinations that result in signals. This should probably be a dynamic
65−-- be an option.
65+-- option.
66--
66--
67-- * ECHO disabled
67-- * ECHO disabled
68−-- - input is not echod to the output.
68+-- - input is not echod to the output. Pobably should be a dynamic option.
69--
69--
70-- * ICANON disabled
70-- * ICANON disabled
71−-- - canonical mode (line mode) input is not used.
71+-- - canonical mode (line mode) input is not used. Probably should be a dynamic option.
72--
72--
73-- * IEXTEN disabled
73-- * IEXTEN disabled
74-- - extended functions are disabled. Uh. Whatever these are.
74-- - extended functions are disabled. Uh. Whatever these are.
src/Graphics/Vty/Terminal.hs → src/Graphics/Vty/Output.hsrenamed+21−25
@@ -1,25 +1,25 @@
1−-- | Terminal IO device.
1+-- | Output interface.
2--
2--
3-- Access to the current terminal or a specific terminal device.
3-- Access to the current terminal or a specific terminal device.
4--
4--
5-- See also:
5-- See also:
6--
6--
7−-- 1. Graphics.Vty.Terminal: This instantiates an abtract interface to the terminal interface based
7+-- 1. "Graphics.Vty.Output": This instantiates an abtract interface to the terminal interface based
8-- on the TERM and COLORTERM environment variables.
8-- on the TERM and COLORTERM environment variables.
9--
9--
10−-- 2. Graphics.Vty.Terminal.Interface: Defines the generic interface all terminals need to implement.
10+-- 2. Graphics.Vty.Output.Interface: Defines the generic interface all terminals need to implement.
11--
11--
12−-- 3. Graphics.Vty.Terminal.TerminfoBased: Defines a terminal instance that uses terminfo for all
12+-- 3. Graphics.Vty.Output.TerminfoBased: Defines a terminal instance that uses terminfo for all
13-- control strings. No attempt is made to change the character set to UTF-8 for these terminals.
13-- control strings. No attempt is made to change the character set to UTF-8 for these terminals.
14-- I don't know a way to reliably determine if that is required or how to do so.
14-- I don't know a way to reliably determine if that is required or how to do so.
15--
15--
16−-- 4. Graphics.Vty.Terminal.XTermColor: This module contains an interface suitable for xterm-like
16+-- 4. Graphics.Vty.Output.XTermColor: This module contains an interface suitable for xterm-like
17-- terminals. These are the terminals where TERM == xterm. This does use terminfo for as many
17-- terminals. These are the terminals where TERM == xterm. This does use terminfo for as many
18-- control codes as possible.
18-- control codes as possible.
19--
19--
20-- Copyright 2009-2010 Corey O'Connor
20-- Copyright 2009-2010 Corey O'Connor
21−module Graphics.Vty.Terminal ( module Graphics.Vty.Terminal
21+module Graphics.Vty.Output ( module Graphics.Vty.Output
22− , Terminal(..) -- \todo hide constructors
22+ , Output(..) -- \todo hide constructors
23 , AssumedState(..)
23 , AssumedState(..)
24 , DisplayContext(..) -- \todo hide constructors
24 , DisplayContext(..) -- \todo hide constructors
25 , output_picture
25 , output_picture
@@ -28,15 +28,14 @@ module Graphics.Vty.Terminal ( module Graphics.Vty.Terminal
28 where
28 where
29
29
30
30
31−import Graphics.Vty.DisplayRegion
31+import Graphics.Vty.Prelude
32+
32−import Graphics.Vty.Terminal.Interface
33+import Graphics.Vty.Output.Interface
33−import Graphics.Vty.Terminal.MacOSX as MacOSX
34+import Graphics.Vty.Output.MacOSX as MacOSX
34−import Graphics.Vty.Terminal.XTermColor as XTermColor
35+import Graphics.Vty.Output.XTermColor as XTermColor
35−import Graphics.Vty.Terminal.TerminfoBased as TerminfoBased
36+import Graphics.Vty.Output.TerminfoBased as TerminfoBased
36
37
37−import Control.Applicative
38import Control.Exception ( SomeException, try )
38import Control.Exception ( SomeException, try )
39−import Control.Monad
40import Control.Monad.Trans
39import Control.Monad.Trans
41
40
42import Data.List ( isPrefixOf )
41import Data.List ( isPrefixOf )
@@ -46,9 +45,9 @@ import GHC.IO.Handle
46import System.Environment
45import System.Environment
47import System.IO
46import System.IO
48
47
49−-- | Returns a `Terminal` for the current terminal.
48+-- | Returns a `Output` for the current terminal.
50--
49--
51−-- The specific Terminal implementation used is hidden from the API user. All terminal
50+-- The specific Output implementation used is hidden from the API user. All terminal
52-- implementations are assumed to perform more, or less, the same. Currently all implementations use
51-- implementations are assumed to perform more, or less, the same. Currently all implementations use
53-- terminfo for at least some terminal specific information. This is why platforms without terminfo
52-- terminfo for at least some terminal specific information. This is why platforms without terminfo
54-- are not supported. However, as mentioned before, any specifics about it being based on terminfo
53-- are not supported. However, as mentioned before, any specifics about it being based on terminfo
@@ -80,16 +79,14 @@ import System.IO
80-- The file descriptor used for output will a duplicate of the current stdout file descriptor.
79-- The file descriptor used for output will a duplicate of the current stdout file descriptor.
81--
80--
82-- todo: add an implementation for windows that does not depend on terminfo. Should be installable
81-- todo: add an implementation for windows that does not depend on terminfo. Should be installable
83−-- with only what is provided in the haskell platform.
82+-- with only what is provided in the haskell platform. Use ansi-terminal
84−--
85−-- todo: The Terminal interface does not provide any input support.
86−current_terminal :: ( Applicative m, MonadIO m ) => m Terminal
83+current_terminal :: ( Applicative m, MonadIO m ) => m Output
87current_terminal = do
84current_terminal = do
88 term_type <- liftIO $ getEnv "TERM"
85 term_type <- liftIO $ getEnv "TERM"
89 out_handle <- liftIO $ hDuplicate stdout
86 out_handle <- liftIO $ hDuplicate stdout
90 terminal_with_name_and_io term_type out_handle
87 terminal_with_name_and_io term_type out_handle
91
88
92−terminal_with_name_and_io :: (Applicative m, MonadIO m) => String -> Handle -> m Terminal
89+terminal_with_name_and_io :: (Applicative m, MonadIO m) => String -> Handle -> m Output
93terminal_with_name_and_io term_type out_handle = do
90terminal_with_name_and_io term_type out_handle = do
94 t <- if "xterm" `isPrefixOf` term_type
91 t <- if "xterm" `isPrefixOf` term_type
95 then do
92 then do
@@ -123,7 +120,7 @@ terminal_with_name_and_io term_type out_handle = do
123--
120--
124-- Currently, the only way to set the cursor position to a given character coordinate is to specify
121-- Currently, the only way to set the cursor position to a given character coordinate is to specify
125-- the coordinate in the Picture instance provided to output_picture or refresh.
122-- the coordinate in the Picture instance provided to output_picture or refresh.
126−set_cursor_pos :: MonadIO m => Terminal -> Int -> Int -> m ()
123+set_cursor_pos :: MonadIO m => Output -> Int -> Int -> m ()
127set_cursor_pos t x y = do
124set_cursor_pos t x y = do
128 bounds <- display_bounds t
125 bounds <- display_bounds t
129 when (x >= 0 && x < region_width bounds && y >= 0 && y < region_height bounds) $ do
126 when (x >= 0 && x < region_width bounds && y >= 0 && y < region_height bounds) $ do
@@ -131,16 +128,15 @@ set_cursor_pos t x y = do
131 liftIO $ send_to_terminal t (move_cursor_required_bytes dc x y) (serialize_move_cursor dc x y)
128 liftIO $ send_to_terminal t (move_cursor_required_bytes dc x y) (serialize_move_cursor dc x y)
132
129
133-- | Hides the cursor
130-- | Hides the cursor
134−hide_cursor :: MonadIO m => Terminal -> m ()
131+hide_cursor :: MonadIO m => Output -> m ()
135hide_cursor t = do
132hide_cursor t = do
136 bounds <- display_bounds t
133 bounds <- display_bounds t
137 dc <- display_context t bounds
134 dc <- display_context t bounds
138 liftIO $ send_to_terminal t (hide_cursor_required_bytes dc) (serialize_hide_cursor dc)
135 liftIO $ send_to_terminal t (hide_cursor_required_bytes dc) (serialize_hide_cursor dc)
139
136
140-- | Shows the cursor
137-- | Shows the cursor
141−show_cursor :: MonadIO m => Terminal -> m ()
138+show_cursor :: MonadIO m => Output -> m ()
142show_cursor t = do
139show_cursor t = do
143 bounds <- display_bounds t
140 bounds <- display_bounds t
144 dc <- display_context t bounds
141 dc <- display_context t bounds
145 liftIO $ send_to_terminal t (show_cursor_required_bytes dc) (serialize_show_cursor dc)
142 liftIO $ send_to_terminal t (show_cursor_required_bytes dc) (serialize_show_cursor dc)
146−
src/Graphics/Vty/Terminal/Interface.hs → src/Graphics/Vty/Output/Interface.hsrenamed+16−12
@@ -5,17 +5,18 @@
5{-# LANGUAGE ExistentialQuantification #-}
5{-# LANGUAGE ExistentialQuantification #-}
6{-# LANGUAGE GADTs #-}
6{-# LANGUAGE GADTs #-}
7{-# LANGUAGE FlexibleContexts #-}
7{-# LANGUAGE FlexibleContexts #-}
8−module Graphics.Vty.Terminal.Interface ( module Graphics.Vty.Terminal.Interface
8+module Graphics.Vty.Output.Interface ( module Graphics.Vty.Output.Interface
9− , OutputBuffer
9+ , OutputBuffer
10− )
10+ )
11 where
11 where
12
12
13+import Graphics.Vty.Prelude
14+
13import Data.Marshalling
15import Data.Marshalling
14
16
15import Graphics.Vty.Picture
17import Graphics.Vty.Picture
16import Graphics.Vty.PictureToSpans
18import Graphics.Vty.PictureToSpans
17import Graphics.Vty.Span
19import Graphics.Vty.Span
18−import Graphics.Vty.DisplayRegion
19
20
20import Graphics.Vty.DisplayAttributes
21import Graphics.Vty.DisplayAttributes
21
22
@@ -27,19 +28,22 @@ import qualified Data.Text.Lazy as TL
27import Data.IORef
28import Data.IORef
28import qualified Data.Vector as Vector
29import qualified Data.Vector as Vector
29
30
30−data Terminal = Terminal
31+data Output = Output
31− { -- | Text identifier for the terminal. Used for debugging.
32+ { -- | Text identifier for the output device. Used for debugging.
32 terminal_ID :: String
33 terminal_ID :: String
33 , release_terminal :: MonadIO m => m ()
34 , release_terminal :: MonadIO m => m ()
34 -- | Clear the display and initialize the terminal to some initial display state.
35 -- | Clear the display and initialize the terminal to some initial display state.
35 --
36 --
36 -- The expectation of a program is that the display starts in some initial state.
37 -- The expectation of a program is that the display starts in some initial state.
37 -- The initial state would consist of fixed values:
38 -- The initial state would consist of fixed values:
39+ --
38 -- - cursor at top left
40 -- - cursor at top left
39 -- - UTF-8 character encoding
41 -- - UTF-8 character encoding
40 -- - drawing characteristics are the default
42 -- - drawing characteristics are the default
43+ --
41 -- The abstract operation I think all these behaviors are instances of is reserving exclusive
44 -- The abstract operation I think all these behaviors are instances of is reserving exclusive
42 -- access to a display such that:
45 -- access to a display such that:
46+ --
43 -- - The previous state cannot be determined
47 -- - The previous state cannot be determined
44 -- - When exclusive access to a display is released the display returns to the previous state.
48 -- - When exclusive access to a display is released the display returns to the previous state.
45 , reserve_display :: MonadIO m => m ()
49 , reserve_display :: MonadIO m => m ()
@@ -59,10 +63,10 @@ data Terminal = Terminal
59 -- | Acquire display access to the given region of the display.
63 -- | Acquire display access to the given region of the display.
60 -- Currently all regions have the upper left corner of (0,0) and the lower right corner at
64 -- Currently all regions have the upper left corner of (0,0) and the lower right corner at
61 -- (max display_width provided_width, max display_height provided_height)
65 -- (max display_width provided_width, max display_height provided_height)
62− , mk_display_context :: MonadIO m => Terminal -> DisplayRegion -> m DisplayContext
66+ , mk_display_context :: MonadIO m => Output -> DisplayRegion -> m DisplayContext
63 }
67 }
64
68
65−display_context :: MonadIO m => Terminal -> DisplayRegion -> m DisplayContext
69+display_context :: MonadIO m => Output -> DisplayRegion -> m DisplayContext
66display_context t = liftIO . mk_display_context t t
70display_context t = liftIO . mk_display_context t t
67
71
68data AssumedState = AssumedState
72data AssumedState = AssumedState
@@ -74,7 +78,7 @@ initial_assumed_state :: AssumedState
74initial_assumed_state = AssumedState Nothing Nothing
78initial_assumed_state = AssumedState Nothing Nothing
75
79
76data DisplayContext = DisplayContext
80data DisplayContext = DisplayContext
77− { context_device :: Terminal
81+ { context_device :: Output
78 -- | Provide the bounds of the display context.
82 -- | Provide the bounds of the display context.
79 , context_region :: DisplayRegion
83 , context_region :: DisplayRegion
80 -- | sets the output position to the specified row and column. Where the number of bytes
84 -- | sets the output position to the specified row and column. Where the number of bytes
@@ -103,7 +107,7 @@ data DisplayContext = DisplayContext
103 , serialize_default_attr :: OutputBuffer -> IO OutputBuffer
107 , serialize_default_attr :: OutputBuffer -> IO OutputBuffer
104 , row_end_required_bytes :: Int
108 , row_end_required_bytes :: Int
105 , serialize_row_end :: OutputBuffer -> IO OutputBuffer
109 , serialize_row_end :: OutputBuffer -> IO OutputBuffer
106− -- | See Graphics.Vty.Terminal.XTermColor.inline_hack
110+ -- | See Graphics.Vty.Output.XTermColor.inline_hack
107 , inline_hack :: IO ()
111 , inline_hack :: IO ()
108 }
112 }
109
113
@@ -273,7 +277,7 @@ serialize_span_op dc (RowEnd _) out_ptr fattr = do
273 out_ptr' <- serialize_row_end dc out_ptr
277 out_ptr' <- serialize_row_end dc out_ptr
274 return (out_ptr', fattr)
278 return (out_ptr', fattr)
275
279
276−send_to_terminal :: Terminal -> Int -> (Ptr Word8 -> IO (Ptr Word8)) -> IO ()
280+send_to_terminal :: Output -> Int -> (Ptr Word8 -> IO (Ptr Word8)) -> IO ()
277send_to_terminal t c f = allocaBytes (fromEnum c) $ \start_ptr -> do
281send_to_terminal t c f = allocaBytes (fromEnum c) $ \start_ptr -> do
278 end_ptr <- f start_ptr
282 end_ptr <- f start_ptr
279 case end_ptr `minusPtr` start_ptr of
283 case end_ptr `minusPtr` start_ptr of
@@ -319,7 +323,7 @@ cursor_column_offset ops cx cy =
319
323
320-- | Not all terminals support all display attributes. This filters a display attribute to what the
324-- | Not all terminals support all display attributes. This filters a display attribute to what the
321-- given terminal can display.
325-- given terminal can display.
322−limit_attr_for_display :: Terminal -> Attr -> Attr
326+limit_attr_for_display :: Output -> Attr -> Attr
323limit_attr_for_display t attr
327limit_attr_for_display t attr
324 = attr { attr_fore_color = clamp_color $ attr_fore_color attr
328 = attr { attr_fore_color = clamp_color $ attr_fore_color attr
325 , attr_back_color = clamp_color $ attr_back_color attr
329 , attr_back_color = clamp_color $ attr_back_color attr
src/Graphics/Vty/Terminal/MacOSX.hs → src/Graphics/Vty/Output/MacOSX.hsrenamed+8−11
@@ -8,11 +8,11 @@
8{-# LANGUAGE MagicHash #-}
8{-# LANGUAGE MagicHash #-}
9{-# LANGUAGE FlexibleInstances #-}
9{-# LANGUAGE FlexibleInstances #-}
10{-# LANGUAGE TypeFamilies #-}
10{-# LANGUAGE TypeFamilies #-}
11−module Graphics.Vty.Terminal.MacOSX ( reserve_terminal )
11+module Graphics.Vty.Output.MacOSX ( reserve_terminal )
12 where
12 where
13
13
14−import Graphics.Vty.Terminal.Interface
14+import Graphics.Vty.Output.Interface
15−import qualified Graphics.Vty.Terminal.TerminfoBased as TerminfoBased
15+import qualified Graphics.Vty.Output.TerminfoBased as TerminfoBased
16
16
17import Control.Applicative
17import Control.Applicative
18import Control.Monad.Trans
18import Control.Monad.Trans
@@ -23,7 +23,7 @@ import System.IO
23-- "xterm-256color" is used.
23-- "xterm-256color" is used.
24--
24--
25-- This effects the terminfo lookup.
25-- This effects the terminfo lookup.
26−reserve_terminal :: ( Applicative m, MonadIO m ) => String -> Handle -> m Terminal
26+reserve_terminal :: ( Applicative m, MonadIO m ) => String -> Handle -> m Output
27reserve_terminal v out_handle = do
27reserve_terminal v out_handle = do
28 let remap_term "iTerm.app" = "xterm-256color"
28 let remap_term "iTerm.app" = "xterm-256color"
29 remap_term _ = "xterm"
29 remap_term _ = "xterm"
@@ -32,13 +32,10 @@ reserve_terminal v out_handle = do
32 hPutStr out_handle str
32 hPutStr out_handle str
33 hFlush out_handle
33 hFlush out_handle
34 t <- TerminfoBased.reserve_terminal (remap_term v) out_handle
34 t <- TerminfoBased.reserve_terminal (remap_term v) out_handle
35− let t' = t
36− { terminal_ID = terminal_ID t ++ " (Mac)"
35+ return $ t { terminal_ID = terminal_ID t ++ " (Mac)"
37− , reserve_display = terminal_app_reserve_display flushed_put
36+ , reserve_display = terminal_app_reserve_display flushed_put
38− , release_display = terminal_app_release_display flushed_put
37+ , release_display = terminal_app_release_display flushed_put
39− }
38+ }
40− return t'
41−
42
39
43-- | Terminal.app requires the xterm-color smcup and rmcup caps. Not the generic xterm ones.
40-- | Terminal.app requires the xterm-color smcup and rmcup caps. Not the generic xterm ones.
44-- Otherwise, Terminal.app expects the xterm caps.
41-- Otherwise, Terminal.app expects the xterm caps.
src/Graphics/Vty/Terminal/Mock.hs → src/Graphics/Vty/Output/Mock.hsrenamed+8−10
@@ -3,13 +3,13 @@
3{-# LANGUAGE TypeFamilies #-}
3{-# LANGUAGE TypeFamilies #-}
4-- | This provides a mock terminal implementation that is nice for testing. This transforms the
4-- | This provides a mock terminal implementation that is nice for testing. This transforms the
5-- output operations to visible characters. Which is nice for some tests.
5-- output operations to visible characters. Which is nice for some tests.
6−module Graphics.Vty.Terminal.Mock ( MockData, mock_terminal )
6+module Graphics.Vty.Output.Mock ( MockData, mock_terminal )
7 where
7 where
8
8
9−import Graphics.Vty.DisplayRegion
9+import Graphics.Vty.Prelude
10+
10−import Graphics.Vty.Terminal.Interface
11+import Graphics.Vty.Output.Interface
11
12
12−import Control.Applicative
13import Control.Monad.Trans
13import Control.Monad.Trans
14
14
15import qualified Data.ByteString as BS
15import qualified Data.ByteString as BS
@@ -32,15 +32,13 @@ type MockData = IORef (UTF8.UTF8 BS.ByteString)
32-- parsing the text representation and determining how the picture was mapped to terminal
32-- parsing the text representation and determining how the picture was mapped to terminal
33-- operations.
33-- operations.
34--
34--
35−-- All terminals support the operations specified in the Terminal class defined in
36−-- Graphics.Vty.Terminal. As an instance of the Terminal class is also an instance of the Monad
37−-- class there exists a monoid that defines it's algebra. The string representation is a sequence of
38−-- identifiers where each identifier is the name of an operation in the algebra.
35+-- The string representation is a sequence of identifiers where each identifier is the name of an
36+-- operation in the algebra.
39−mock_terminal :: (Applicative m, MonadIO m) => DisplayRegion -> m (MockData, Terminal)
37+mock_terminal :: (Applicative m, MonadIO m) => DisplayRegion -> m (MockData, Output)
40mock_terminal r = liftIO $ do
38mock_terminal r = liftIO $ do
41 out_ref <- newIORef undefined
39 out_ref <- newIORef undefined
42 new_assumed_state_ref <- newIORef initial_assumed_state
40 new_assumed_state_ref <- newIORef initial_assumed_state
43− let t = Terminal
41+ let t = Output
44 { terminal_ID = "mock terminal"
42 { terminal_ID = "mock terminal"
45 , release_terminal = return ()
43 , release_terminal = return ()
46 , reserve_display = return ()
44 , reserve_display = return ()
src/Graphics/Vty/Terminal/TerminfoBased.hs → src/Graphics/Vty/Output/TerminfoBased.hsrenamed+13−13
@@ -7,19 +7,19 @@
7-- Copyright Corey O'Connor (coreyoconnor@gmail.com)
7-- Copyright Corey O'Connor (coreyoconnor@gmail.com)
8{-# LANGUAGE FlexibleInstances #-}
8{-# LANGUAGE FlexibleInstances #-}
9{-# OPTIONS_GHC -D_XOPEN_SOURCE=500 #-}
9{-# OPTIONS_GHC -D_XOPEN_SOURCE=500 #-}
10+{-# CFILES gwinsz.c #-}
10−module Graphics.Vty.Terminal.TerminfoBased ( reserve_terminal )
11+module Graphics.Vty.Output.TerminfoBased ( reserve_terminal )
11 where
12 where
12
13
14+import Graphics.Vty.Prelude
15+
13import Data.Terminfo.Parse
16import Data.Terminfo.Parse
14import Data.Terminfo.Eval
17import Data.Terminfo.Eval
15
18
16import Graphics.Vty.Attributes
19import Graphics.Vty.Attributes
17import Graphics.Vty.DisplayAttributes
20import Graphics.Vty.DisplayAttributes
18−import Graphics.Vty.Terminal.Interface
21+import Graphics.Vty.Output.Interface
19−import Graphics.Vty.DisplayRegion
20
22
21−import Control.Applicative
22−import Control.Monad ( foldM, when )
23import Control.Monad.Trans
23import Control.Monad.Trans
24
24
25import Data.Bits ( (.&.) )
25import Data.Bits ( (.&.) )
@@ -59,7 +59,7 @@ data DisplayAttrCaps = DisplayAttrCaps
59 , enter_bold_mode :: Maybe CapExpression
59 , enter_bold_mode :: Maybe CapExpression
60 }
60 }
61
61
62−send_cap_to_terminal :: Terminal -> CapExpression -> [CapParam] -> IO ()
62+send_cap_to_terminal :: Output -> CapExpression -> [CapParam] -> IO ()
63send_cap_to_terminal t cap cap_params = do
63send_cap_to_terminal t cap cap_params = do
64 send_to_terminal t (cap_expression_required_bytes cap cap_params)
64 send_to_terminal t (cap_expression_required_bytes cap cap_params)
65 (serialize_cap_expression cap cap_params)
65 (serialize_cap_expression cap cap_params)
@@ -74,7 +74,7 @@ send_cap_to_terminal t cap cap_params = do
74 - todo: Some display attributes like underline and bold have independent string capabilities that
74 - todo: Some display attributes like underline and bold have independent string capabilities that
75 - should be used instead of the generic "sgr" string capability.
75 - should be used instead of the generic "sgr" string capability.
76 -}
76 -}
77−reserve_terminal :: ( Applicative m, MonadIO m ) => String -> Handle -> m Terminal
77+reserve_terminal :: ( Applicative m, MonadIO m ) => String -> Handle -> m Output
78reserve_terminal in_ID out_handle = liftIO $ do
78reserve_terminal in_ID out_handle = liftIO $ do
79 ti <- Terminfo.setupTerm in_ID
79 ti <- Terminfo.setupTerm in_ID
80 -- assumes set foreground always implies set background exists.
80 -- assumes set foreground always implies set background exists.
@@ -110,7 +110,7 @@ reserve_terminal in_ID out_handle = liftIO $ do
110 <*> require_cap ti "el"
110 <*> require_cap ti "el"
111 <*> current_display_attr_caps ti
111 <*> current_display_attr_caps ti
112 new_assumed_state_ref <- newIORef initial_assumed_state
112 new_assumed_state_ref <- newIORef initial_assumed_state
113− let t = Terminal
113+ let t = Output
114 { terminal_ID = in_ID
114 { terminal_ID = in_ID
115 , release_terminal = liftIO $ do
115 , release_terminal = liftIO $ do
116 send_cap set_default_attr []
116 send_cap set_default_attr []
@@ -129,7 +129,7 @@ reserve_terminal in_ID out_handle = liftIO $ do
129 raw_size <- liftIO $ get_window_size
129 raw_size <- liftIO $ get_window_size
130 case raw_size of
130 case raw_size of
131 (w, h) | w < 0 || h < 0 -> fail $ "getwinsize returned < 0 : " ++ show raw_size
131 (w, h) | w < 0 || h < 0 -> fail $ "getwinsize returned < 0 : " ++ show raw_size
132− | otherwise -> return $ DisplayRegion (toEnum w) (toEnum h)
132+ | otherwise -> return (w,h)
133 , output_byte_buffer = \out_ptr out_byte_count -> do
133 , output_byte_buffer = \out_ptr out_byte_count -> do
134 hPutBuf out_handle out_ptr (fromEnum out_byte_count)
134 hPutBuf out_handle out_ptr (fromEnum out_byte_count)
135 hFlush out_handle
135 hFlush out_handle
@@ -189,7 +189,7 @@ get_window_size = do
189 (a,b) <- (`divMod` 65536) `fmap` c_get_window_size
189 (a,b) <- (`divMod` 65536) `fmap` c_get_window_size
190 return (fromIntegral b, fromIntegral a)
190 return (fromIntegral b, fromIntegral a)
191
191
192−terminfo_display_context :: Terminal -> TerminfoCaps -> DisplayRegion -> IO DisplayContext
192+terminfo_display_context :: Output -> TerminfoCaps -> DisplayRegion -> IO DisplayContext
193terminfo_display_context t_actual terminfo_caps r =
193terminfo_display_context t_actual terminfo_caps r =
194 let dc = DisplayContext
194 let dc = DisplayContext
195 { context_device = t_actual
195 { context_device = t_actual
@@ -461,8 +461,8 @@ style_to_apply_seq s = concat
461 , apply_if_required ApplyBlink bold
461 , apply_if_required ApplyBlink bold
462 ]
462 ]
463 where
463 where
464− apply_if_required ap flag
464+ apply_if_required op flag
465− = if 0 == ( flag .&. s )
465+ = if 0 == (flag .&. s)
466 then []
466 then []
467− else [ ap ]
467+ else [op]
468
468
src/Graphics/Vty/Terminal/XTermColor.hs → src/Graphics/Vty/Output/XTermColor.hsrenamed+5−5
@@ -1,9 +1,9 @@
1-- Copyright 2009-2010 Corey O'Connor
1-- Copyright 2009-2010 Corey O'Connor
2−module Graphics.Vty.Terminal.XTermColor ( reserve_terminal )
2+module Graphics.Vty.Output.XTermColor ( reserve_terminal )
3 where
3 where
4
4
5−import Graphics.Vty.Terminal.Interface
5+import Graphics.Vty.Output.Interface
6−import qualified Graphics.Vty.Terminal.TerminfoBased as TerminfoBased
6+import qualified Graphics.Vty.Output.TerminfoBased as TerminfoBased
7
7
8import Control.Applicative
8import Control.Applicative
9import Control.Monad.Trans
9import Control.Monad.Trans
@@ -14,7 +14,7 @@ import qualified Data.Text.Encoding as T
14import System.IO
14import System.IO
15
15
16-- | Initialize the display to UTF-8.
16-- | Initialize the display to UTF-8.
17−reserve_terminal :: ( Applicative m, MonadIO m ) => String -> Handle -> m Terminal
17+reserve_terminal :: ( Applicative m, MonadIO m ) => String -> Handle -> m Output
18reserve_terminal variant out_handle = liftIO $ do
18reserve_terminal variant out_handle = liftIO $ do
19 let flushed_put str = do
19 let flushed_put str = do
20 hPutStr out_handle str
20 hPutStr out_handle str
@@ -45,7 +45,7 @@ set_default_char_set = "\ESC%@"
45-- | I think xterm is broken: Reseting the background color as the first bytes serialized on a
45-- | I think xterm is broken: Reseting the background color as the first bytes serialized on a
46-- new line does not effect the background color xterm uses to clear the line. Which is used
46-- new line does not effect the background color xterm uses to clear the line. Which is used
47-- *after* the next newline.
47-- *after* the next newline.
48−xterm_inline_hack :: Terminal -> IO ()
48+xterm_inline_hack :: Output -> IO ()
49xterm_inline_hack t = do
49xterm_inline_hack t = do
50 let s_utf8 = T.encodeUtf8 $ T.pack "\ESC[K"
50 let s_utf8 = T.encodeUtf8 $ T.pack "\ESC[K"
51 send_to_terminal t (utf8_text_required_bytes s_utf8)
51 send_to_terminal t (utf8_text_required_bytes s_utf8)
src/Graphics/Vty/PictureToSpans.hs+3−4
@@ -8,13 +8,13 @@
8 -}
8 -}
9module Graphics.Vty.PictureToSpans where
9module Graphics.Vty.PictureToSpans where
10
10
11−import Graphics.Vty.DisplayRegion
11+import Graphics.Vty.Prelude
12+
12import Graphics.Vty.Image
13import Graphics.Vty.Image
13import Graphics.Vty.Image.Internal
14import Graphics.Vty.Image.Internal
14import Graphics.Vty.Picture
15import Graphics.Vty.Picture
15import Graphics.Vty.Span
16import Graphics.Vty.Span
16
17
17−import Control.Applicative
18import Control.Lens hiding ( op )
18import Control.Lens hiding ( op )
19import Control.Monad.Reader
19import Control.Monad.Reader
20import Control.Monad.State.Strict hiding ( state )
20import Control.Monad.State.Strict hiding ( state )
@@ -71,8 +71,7 @@ display_ops_for_pic pic r = Vector.create (combined_ops_for_layers pic r)
71--
71--
72-- largerly used only for debugging.
72-- largerly used only for debugging.
73display_ops_for_image :: Image -> DisplayOps
73display_ops_for_image :: Image -> DisplayOps
74−display_ops_for_image i = display_ops_for_pic (pic_for_image i)
74+display_ops_for_image i = display_ops_for_pic (pic_for_image i) (image_width i, image_height i)
75− (DisplayRegion (image_width i) (image_height i))
76
75
77-- | Produces the span ops for each layer then combines them.
76-- | Produces the span ops for each layer then combines them.
78--
77--
src/Graphics/Vty/Prelude.hsnew file+18
@@ -0,0 +1,18 @@
1+-- | Prelude for Vty modules. Not particularly useful outside of Vty.
2+module Graphics.Vty.Prelude ( module Graphics.Vty.Prelude
3+ , module Control.Applicative
4+ , module Control.Monad
5+ )
6+where
7+
8+import Control.Applicative hiding ((<|>))
9+import Control.Monad
10+
11+-- | Named alias for a Int pair
12+type DisplayRegion = (Int,Int)
13+
14+region_width :: DisplayRegion -> Int
15+region_width = fst
16+
17+region_height :: DisplayRegion -> Int
18+region_height = snd
src/Graphics/Vty/Span.hs+4−5
@@ -16,16 +16,15 @@
16module Graphics.Vty.Span
16module Graphics.Vty.Span
17 where
17 where
18
18
19−import Graphics.Vty.DisplayRegion
19+import Graphics.Vty.Prelude
20−import Graphics.Vty.Image
21
20
21+import Graphics.Vty.Image
22import Graphics.Vty.Image.Internal ( clip_text )
22import Graphics.Vty.Image.Internal ( clip_text )
23
23
24+import qualified Data.Text.Lazy as TL
24import Data.Vector (Vector)
25import Data.Vector (Vector)
25import qualified Data.Vector as Vector
26import qualified Data.Vector as Vector
26
27
27−import qualified Data.Text.Lazy as TL
28−
29-- | This represents an operation on the terminal. Either an attribute change or the output of a
28-- | This represents an operation on the terminal. Either an attribute change or the output of a
30-- text string.
29-- text string.
31data SpanOp =
30data SpanOp =
@@ -112,7 +111,7 @@ display_ops_rows :: DisplayOps -> Int
112display_ops_rows ops = Vector.length ops
111display_ops_rows ops = Vector.length ops
113
112
114effected_region :: DisplayOps -> DisplayRegion
113effected_region :: DisplayOps -> DisplayRegion
115−effected_region ops = DisplayRegion (display_ops_columns ops) (display_ops_rows ops)
114+effected_region ops = (display_ops_columns ops, display_ops_rows ops)
116
115
117-- | The number of columns a SpanOps effects.
116-- | The number of columns a SpanOps effects.
118span_ops_effected_columns :: SpanOps -> Int
117span_ops_effected_columns :: SpanOps -> Int
test/BenchImageFuzz.hs+1−1
@@ -20,7 +20,7 @@ random_picture = pic_for_image <$> random_image
20
20
21bench_0 = do
21bench_0 = do
22 vty <- mkVty
22 vty <- mkVty
23− DisplayRegion w h <- display_bounds $ terminal vty
23+ (w,h) <- display_bounds $ terminal vty
24 let pictures = replicateM 3000 random_picture
24 let pictures = replicateM 3000 random_picture
25 bench ps = do
25 bench ps = do
26 forM ps (update vty)
26 forM ps (update vty)
test/BenchNoDiffOpt.hs+1−1
@@ -19,7 +19,7 @@ bench_0 = do
19 let fixed_gen = mkStdGen 0
19 let fixed_gen = mkStdGen 0
20 setStdGen fixed_gen
20 setStdGen fixed_gen
21 vty <- mkVty
21 vty <- mkVty
22− DisplayRegion w h <- display_bounds $ terminal vty
22+ (w,h) <- display_bounds $ terminal vty
23 let images = return $ (image_0, image_1)
23 let images = return $ (image_0, image_1)
24 image_0 = char_fill def_attr 'X' w h
24 image_0 = char_fill def_attr 'X' w h
25 image_1 = char_fill def_attr '0' w h
25 image_1 = char_fill def_attr '0' w h
test/BenchRenderChar.hs+2−2
@@ -11,7 +11,7 @@ import Control.Monad ( forM_ )
11
11
12bench_0 = do
12bench_0 = do
13 vty <- mkVty
13 vty <- mkVty
14− DisplayRegion w h <- display_bounds $ terminal vty
14+ (w,h) <- display_bounds $ terminal vty
15 let test_chars = return $ take 500 $ cycle $ [ c | c <- ['a'..'z']]
15 let test_chars = return $ take 500 $ cycle $ [ c | c <- ['a'..'z']]
16 bench d = do
16 bench d = do
17 forM_ d $ \test_char -> do
17 forM_ d $ \test_char -> do
@@ -27,7 +27,7 @@ test_image_using_char c w h
27
27
28bench_1 = do
28bench_1 = do
29 vty <- mkVty
29 vty <- mkVty
30− DisplayRegion w h <- display_bounds $ terminal vty
30+ (w,h) <- display_bounds $ terminal vty
31 let test_chars = return $ take 500 $ cycle $ [ c | c <- ['a'..'z']]
31 let test_chars = return $ take 500 $ cycle $ [ c | c <- ['a'..'z']]
32 bench d = do
32 bench d = do
33 forM_ d $ \test_char -> do
33 forM_ d $ \test_char -> do
test/BenchVerticalScroll.hs+1−1
@@ -53,7 +53,7 @@ clines g maxll = map (pad maxll . horiz_cat . map (uncurry string))
53 where (g1,g2) = split g
53 where (g1,g2) = split g
54
54
55benchgen :: DisplayRegion -> [Picture]
55benchgen :: DisplayRegion -> [Picture]
56−benchgen (DisplayRegion w h)
56+benchgen (w,h)
57 = take 2000 $ map ((\i -> pic_for_image i) . vert_cat . take (fromEnum h))
57 = take 2000 $ map ((\i -> pic_for_image i) . vert_cat . take (fromEnum h))
58 $ tails
58 $ tails
59 $ clines (mkStdGen 80) w
59 $ clines (mkStdGen 80) w
test/Rouge.hs+1−1
@@ -116,7 +116,7 @@ update_display :: Game ()
116update_display = do
116update_display = do
117 let info = string def_attr "Move with the arrows keys. Press ESC to exit."
117 let info = string def_attr "Move with the arrows keys. Press ESC to exit."
118 -- determine offsets to place the dude in the center of the level.
118 -- determine offsets to place the dude in the center of the level.
119− DisplayRegion w h <- asks terminal >>= liftIO . display_bounds
119+ (w,h) <- asks terminal >>= liftIO . display_bounds
120 the_dude <- gets dude
120 the_dude <- gets dude
121 let ox = (w `div` 2) - dude_x the_dude
121 let ox = (w `div` 2) - dude_x the_dude
122 oy = (h `div` 2) - dude_y the_dude
122 oy = (h `div` 2) - dude_y the_dude
test/Verify/Graphics/Vty/Terminal.hs → test/Verify/Graphics/Vty/Output.hsrenamed+2−2
@@ -1,6 +1,6 @@
1−module Verify.Graphics.Vty.Terminal where
1+module Verify.Graphics.Vty.Output where
2
2
3−import Graphics.Vty.Terminal.Mock
3+import Graphics.Vty.Output.Mock
4
4
5import qualified Data.ByteString as BS
5import qualified Data.ByteString as BS
6import Data.IORef
6import Data.IORef
test/Verify/Graphics/Vty/Picture.hs+2−1
@@ -4,12 +4,13 @@ module Verify.Graphics.Vty.Picture ( module Verify.Graphics.Vty.Picture
4 )
4 )
5 where
5 where
6
6
7+import Verify.Graphics.Vty.Prelude
8+
7import Graphics.Vty.Picture
9import Graphics.Vty.Picture
8import Graphics.Vty.Debug
10import Graphics.Vty.Debug
9
11
10import Verify.Graphics.Vty.Attributes
12import Verify.Graphics.Vty.Attributes
11import Verify.Graphics.Vty.Image
13import Verify.Graphics.Vty.Image
12−import Verify.Graphics.Vty.DisplayRegion
13
14
14import Verify
15import Verify
15
16
test/Verify/Graphics/Vty/DisplayRegion.hs → test/Verify/Graphics/Vty/Prelude.hsrenamed+6−5
@@ -1,11 +1,12 @@
1−module Verify.Graphics.Vty.DisplayRegion ( module Verify.Graphics.Vty.DisplayRegion
1+module Verify.Graphics.Vty.Prelude ( module Verify.Graphics.Vty.Prelude
2− , module Graphics.Vty.DisplayRegion
2+ , module Graphics.Vty.Prelude
3− , MockWindow(..)
3+ , MockWindow(..)
4− )
4+ )
5 where
5 where
6
6
7+import Graphics.Vty.Prelude
8+
7import Graphics.Vty.Debug
9import Graphics.Vty.Debug
8−import Graphics.Vty.DisplayRegion
9
10
10import Verify
11import Verify
11
12
test/VerifyCropSpanGeneration.hs+2−1
@@ -2,7 +2,8 @@
2{-# LANGUAGE NamedFieldPuns #-}
2{-# LANGUAGE NamedFieldPuns #-}
3module VerifyCropSpanGeneration where
3module VerifyCropSpanGeneration where
4
4
5−import Verify.Graphics.Vty.DisplayRegion
5+import Verify.Graphics.Vty.Prelude
6+
6import Verify.Graphics.Vty.Image
7import Verify.Graphics.Vty.Image
7import Verify.Graphics.Vty.Picture
8import Verify.Graphics.Vty.Picture
8import Verify.Graphics.Vty.Span
9import Verify.Graphics.Vty.Span
test/VerifyEvalTerminfoCaps.hs+1−1
@@ -11,7 +11,7 @@ import Control.DeepSeq
11import qualified System.Console.Terminfo as Terminfo
11import qualified System.Console.Terminfo as Terminfo
12
12
13import Verify
13import Verify
14−import Verify.Graphics.Vty.Terminal
14+import Verify.Graphics.Vty.Output
15
15
16import Control.Applicative ( (<$>) )
16import Control.Applicative ( (<$>) )
17import Control.Exception ( try, SomeException(..) )
17import Control.Exception ( try, SomeException(..) )
test/VerifyInline.hs+3−3
@@ -1,10 +1,10 @@
1module VerifyInline where
1module VerifyInline where
2
2
3import Graphics.Vty.Inline
3import Graphics.Vty.Inline
4−import Graphics.Vty.Terminal
4+import Graphics.Vty.Output
5−import Graphics.Vty.Terminal.TerminfoBased as TerminfoBased
5+import Graphics.Vty.Output.TerminfoBased as TerminfoBased
6
6
7−import Verify.Graphics.Vty.Terminal
7+import Verify.Graphics.Vty.Output
8
8
9import Verify
9import Verify
10
10
test/VerifyLayersSpanGeneration.hs+9−8
@@ -2,7 +2,8 @@
2{-# LANGUAGE NamedFieldPuns #-}
2{-# LANGUAGE NamedFieldPuns #-}
3module VerifyLayersSpanGeneration where
3module VerifyLayersSpanGeneration where
4
4
5−import Verify.Graphics.Vty.DisplayRegion
5+import Verify.Graphics.Vty.Prelude
6+
6import Verify.Graphics.Vty.Image
7import Verify.Graphics.Vty.Image
7import Verify.Graphics.Vty.Picture
8import Verify.Graphics.Vty.Picture
8import Verify.Graphics.Vty.Span
9import Verify.Graphics.Vty.Span
@@ -21,7 +22,7 @@ larger_horiz_span_occlusion row_0 row_1 =
21 (i_larger, i_smaller) = if image_width i_0 > image_width i_1 then (i_0, i_1) else (i_1, i_0)
22 (i_larger, i_smaller) = if image_width i_0 > image_width i_1 then (i_0, i_1) else (i_1, i_0)
22 expected_ops = display_ops_for_image i_larger
23 expected_ops = display_ops_for_image i_larger
23 p = pic_for_layers [i_larger, i_smaller]
24 p = pic_for_layers [i_larger, i_smaller]
24− ops = display_ops_for_pic p $ DisplayRegion (image_width i_larger) (image_height i_larger)
25+ ops = display_ops_for_pic p (image_width i_larger,image_height i_larger)
25 in verify_ops_equality expected_ops ops
26 in verify_ops_equality expected_ops ops
26
27
27-- | Two rows stacked vertical is equivalent to the first row rendered as the top layer and the
28-- | Two rows stacked vertical is equivalent to the first row rendered as the top layer and the
@@ -35,7 +36,7 @@ vert_stack_layer_equivalence_0 row_0 row_1 =
35 i_lower = background_fill (image_width i_0) 1 <-> i_1
36 i_lower = background_fill (image_width i_0) 1 <-> i_1
36 p_layered = pic_for_layers [i_0, i_lower]
37 p_layered = pic_for_layers [i_0, i_lower]
37 expected_ops = display_ops_for_image i
38 expected_ops = display_ops_for_image i
38− ops_layered = display_ops_for_pic p_layered $ DisplayRegion (image_width i_lower) (image_height i_lower)
39+ ops_layered = display_ops_for_pic p_layered (image_width i_lower,image_height i_lower)
39 in verify_ops_equality expected_ops ops_layered
40 in verify_ops_equality expected_ops ops_layered
40
41
41vert_stack_layer_equivalence_1 :: SingleRowSingleAttrImage -> SingleRowSingleAttrImage -> Result
42vert_stack_layer_equivalence_1 :: SingleRowSingleAttrImage -> SingleRowSingleAttrImage -> Result
@@ -48,7 +49,7 @@ vert_stack_layer_equivalence_1 row_0 row_1 =
48 i_upper = background_fill (image_width i_0) 1 <-> i_1
49 i_upper = background_fill (image_width i_0) 1 <-> i_1
49 p_layered = pic_for_layers [i_upper, i_lower]
50 p_layered = pic_for_layers [i_upper, i_lower]
50 expected_ops = display_ops_for_image i
51 expected_ops = display_ops_for_image i
51− ops_layered = display_ops_for_pic p_layered $ DisplayRegion (image_width i_lower) (image_height i_lower)
52+ ops_layered = display_ops_for_pic p_layered (image_width i_lower,image_height i_lower)
52 in verify_ops_equality expected_ops ops_layered
53 in verify_ops_equality expected_ops ops_layered
53
54
54-- | Two rows horiz joined is equivalent to the first row rendered as the top layer and the
55-- | Two rows horiz joined is equivalent to the first row rendered as the top layer and the
@@ -62,7 +63,7 @@ horiz_join_layer_equivalence_0 row_0 row_1 =
62 i_lower = background_fill (image_width i_0) 1 <|> i_1
63 i_lower = background_fill (image_width i_0) 1 <|> i_1
63 p_layered = pic_for_layers [i_0, i_lower]
64 p_layered = pic_for_layers [i_0, i_lower]
64 expected_ops = display_ops_for_image i
65 expected_ops = display_ops_for_image i
65− ops_layered = display_ops_for_pic p_layered $ DisplayRegion (image_width i_lower) (image_height i_lower)
66+ ops_layered = display_ops_for_pic p_layered (image_width i_lower,image_height i_lower)
66 in verify_ops_equality expected_ops ops_layered
67 in verify_ops_equality expected_ops ops_layered
67
68
68horiz_join_layer_equivalence_1 :: SingleRowSingleAttrImage -> SingleRowSingleAttrImage -> Result
69horiz_join_layer_equivalence_1 :: SingleRowSingleAttrImage -> SingleRowSingleAttrImage -> Result
@@ -75,7 +76,7 @@ horiz_join_layer_equivalence_1 row_0 row_1 =
75 i_upper = background_fill (image_width i_0) 1 <|> i_1
76 i_upper = background_fill (image_width i_0) 1 <|> i_1
76 p_layered = pic_for_layers [i_upper, i_lower]
77 p_layered = pic_for_layers [i_upper, i_lower]
77 expected_ops = display_ops_for_image i
78 expected_ops = display_ops_for_image i
78− ops_layered = display_ops_for_pic p_layered $ DisplayRegion (image_width i_lower) (image_height i_lower)
79+ ops_layered = display_ops_for_pic p_layered (image_width i_lower,image_height i_lower)
79 in verify_ops_equality expected_ops ops_layered
80 in verify_ops_equality expected_ops ops_layered
80
81
81horiz_join_alternate_0 :: Result
82horiz_join_alternate_0 :: Result
@@ -90,7 +91,7 @@ horiz_join_alternate_0 =
90 layer_1 = horiz_cat $ replicate size $ background_fill size 1 <|> i_1
91 layer_1 = horiz_cat $ replicate size $ background_fill size 1 <|> i_1
91 expected_ops = display_ops_for_image i
92 expected_ops = display_ops_for_image i
92 ops_layered = display_ops_for_pic (pic_for_layers [layer_0, layer_1])
93 ops_layered = display_ops_for_pic (pic_for_layers [layer_0, layer_1])
93− (DisplayRegion (image_width i) (image_height i))
94+ (image_width i,image_height i)
94 in verify_ops_equality expected_ops ops_layered
95 in verify_ops_equality expected_ops ops_layered
95
96
96horiz_join_alternate_1 :: Result
97horiz_join_alternate_1 :: Result
@@ -104,7 +105,7 @@ horiz_join_alternate_1 =
104 layers = [l | b <- take 4 [0,size*2..], let l = background_fill b 1 <|> i_0 <|> i_1]
105 layers = [l | b <- take 4 [0,size*2..], let l = background_fill b 1 <|> i_0 <|> i_1]
105 expected_ops = display_ops_for_image i
106 expected_ops = display_ops_for_image i
106 ops_layered = display_ops_for_pic (pic_for_layers layers)
107 ops_layered = display_ops_for_pic (pic_for_layers layers)
107− (DisplayRegion (image_width i) (image_height i))
108+ (image_width i,image_height i)
108 in verify_ops_equality expected_ops ops_layered
109 in verify_ops_equality expected_ops ops_layered
109
110
110tests :: IO [Test]
111tests :: IO [Test]
test/VerifyTerminal.hs → test/VerifyOutput.hsrenamed+3−3
@@ -2,13 +2,13 @@
2 - This assumes appropriate definitions exist in the current environment for the terminals of
2 - This assumes appropriate definitions exist in the current environment for the terminals of
3 - interest.
3 - interest.
4 -}
4 -}
5−module VerifyTerminal where
5+module VerifyOutput where
6import Verify
6import Verify
7
7
8import Graphics.Vty
8import Graphics.Vty
9
9
10import Verify.Graphics.Vty.Image
10import Verify.Graphics.Vty.Image
11−import Verify.Graphics.Vty.Terminal
11+import Verify.Graphics.Vty.Output
12
12
13import Control.Monad
13import Control.Monad
14
14
@@ -49,7 +49,7 @@ smoke_test_term term_name i = do
49 t <- terminal_with_name_and_io term_name null_out
49 t <- terminal_with_name_and_io term_name null_out
50 putStrLn $ "context color count: " ++ show (context_color_count t)
50 putStrLn $ "context color count: " ++ show (context_color_count t)
51 reserve_display t
51 reserve_display t
52− dc <- display_context t (DisplayRegion 100 100)
52+ dc <- display_context t (100,100)
53 -- always show the cursor to produce tests for terminals with no cursor support.
53 -- always show the cursor to produce tests for terminals with no cursor support.
54 let pic = (pic_for_image i) { pic_cursor = Cursor 0 0 }
54 let pic = (pic_for_image i) { pic_cursor = Cursor 0 0 }
55 output_picture dc pic
55 output_picture dc pic
test/VerifyParseTerminfoCaps.hs+1−1
@@ -6,7 +6,7 @@ import Prelude hiding ( catch )
6import qualified System.Console.Terminfo as Terminfo
6import qualified System.Console.Terminfo as Terminfo
7
7
8import Verify.Data.Terminfo.Parse
8import Verify.Data.Terminfo.Parse
9−import Verify.Graphics.Vty.Terminal
9+import Verify.Graphics.Vty.Output
10import Verify
10import Verify
11
11
12import Data.Maybe ( catMaybes, fromJust )
12import Data.Maybe ( catMaybes, fromJust )
test/VerifySimpleSpanGeneration.hs+3−2
@@ -2,7 +2,8 @@
2{-# LANGUAGE NamedFieldPuns #-}
2{-# LANGUAGE NamedFieldPuns #-}
3module VerifySimpleSpanGeneration where
3module VerifySimpleSpanGeneration where
4
4
5−import Verify.Graphics.Vty.DisplayRegion
5+import Verify.Graphics.Vty.Prelude
6+
6import Verify.Graphics.Vty.Image
7import Verify.Graphics.Vty.Image
7import Verify.Graphics.Vty.Picture
8import Verify.Graphics.Vty.Picture
8import Verify.Graphics.Vty.Span
9import Verify.Graphics.Vty.Span
@@ -152,7 +153,7 @@ single_attr_single_span_stack_op_coverage stack =
152image_coverage_matches_bounds :: Image -> Result
153image_coverage_matches_bounds :: Image -> Result
153image_coverage_matches_bounds i =
154image_coverage_matches_bounds i =
154 let p = pic_for_image i
155 let p = pic_for_image i
155− r = DisplayRegion (image_width i) (image_height i)
156+ r = (image_width i,image_height i)
156 ops = display_ops_for_pic p r
157 ops = display_ops_for_pic p r
157 in verify_all_spans_have_width i ops (image_width i)
158 in verify_all_spans_have_width i ops (image_width i)
158
159
test/VerifyUsingMockInput.hs+2−1
@@ -6,7 +6,7 @@
6 -}
6 -}
7module Main where
7module Main where
8
8
9−import Verify.Graphics.Vty.Terminal
9+import Verify.Graphics.Vty.Output
10
10
11import Data.List (intersperse)
11import Data.List (intersperse)
12
12
@@ -82,6 +82,7 @@ gen_events_using_io_actions max_duration input_action output_action = do
82 Just () <- timeout max_duration' $ takeMVar read_complete
82 Just () <- timeout max_duration' $ takeMVar read_complete
83 return ()
83 return ()
84
84
85+compare_events :: (Show a1, Show a, Eq a1) => a -> [a1] -> [a1] -> IO Bool
85compare_events input_spec expected_events out_events = compare_events' expected_events out_events
86compare_events input_spec expected_events out_events = compare_events' expected_events out_events
86 where
87 where
87 compare_events' [] [] = return True
88 compare_events' [] [] = return True
test/VerifyUsingMockTerminal.hs+11−10
@@ -1,12 +1,13 @@
1module VerifyUsingMockTerminal where
1module VerifyUsingMockTerminal where
2
2
3−import Verify.Graphics.Vty.DisplayRegion
3+import Verify.Graphics.Vty.Prelude
4+
4import Verify.Graphics.Vty.Picture
5import Verify.Graphics.Vty.Picture
5import Verify.Graphics.Vty.Image
6import Verify.Graphics.Vty.Image
6import Verify.Graphics.Vty.Span
7import Verify.Graphics.Vty.Span
7−import Verify.Graphics.Vty.Terminal
8+import Verify.Graphics.Vty.Output
8−import Graphics.Vty.Terminal
9+import Graphics.Vty.Output
9−import Graphics.Vty.Terminal.Mock
10+import Graphics.Vty.Output.Mock
10
11
11import Graphics.Vty.Debug
12import Graphics.Vty.Debug
12
13
@@ -20,7 +21,7 @@ import System.IO
20
21
21unit_image_unit_bounds :: UnitImage -> Property
22unit_image_unit_bounds :: UnitImage -> Property
22unit_image_unit_bounds (UnitImage _ i) = liftIOResult $ do
23unit_image_unit_bounds (UnitImage _ i) = liftIOResult $ do
23− (_,t) <- mock_terminal (DisplayRegion 1 1)
24+ (_,t) <- mock_terminal (1,1)
24 dc <- display_bounds t >>= display_context t
25 dc <- display_bounds t >>= display_context t
25 let pic = pic_for_image i
26 let pic = pic_for_image i
26 output_picture dc pic
27 output_picture dc pic
@@ -28,7 +29,7 @@ unit_image_unit_bounds (UnitImage _ i) = liftIOResult $ do
28
29
29unit_image_arb_bounds :: UnitImage -> MockWindow -> Property
30unit_image_arb_bounds :: UnitImage -> MockWindow -> Property
30unit_image_arb_bounds (UnitImage _ i) (MockWindow w h) = liftIOResult $ do
31unit_image_arb_bounds (UnitImage _ i) (MockWindow w h) = liftIOResult $ do
31− (_,t) <- mock_terminal (DisplayRegion w h)
32+ (_,t) <- mock_terminal (w,h)
32 dc <- display_bounds t >>= display_context t
33 dc <- display_bounds t >>= display_context t
33 let pic = pic_for_image i
34 let pic = pic_for_image i
34 output_picture dc pic
35 output_picture dc pic
@@ -36,7 +37,7 @@ unit_image_arb_bounds (UnitImage _ i) (MockWindow w h) = liftIOResult $ do
36
37
37single_T_row :: MockWindow -> Property
38single_T_row :: MockWindow -> Property
38single_T_row (MockWindow w h) = liftIOResult $ do
39single_T_row (MockWindow w h) = liftIOResult $ do
39− (mock_data,t) <- mock_terminal (DisplayRegion w h)
40+ (mock_data,t) <- mock_terminal (w,h)
40 dc <- display_bounds t >>= display_context t
41 dc <- display_bounds t >>= display_context t
41 -- create an image that contains just the character T repeated for a single row
42 -- create an image that contains just the character T repeated for a single row
42 let i = horiz_cat $ replicate (fromEnum w) (char def_attr 'T')
43 let i = horiz_cat $ replicate (fromEnum w) (char def_attr 'T')
@@ -51,7 +52,7 @@ single_T_row (MockWindow w h) = liftIOResult $ do
51
52
52many_T_rows :: MockWindow -> Property
53many_T_rows :: MockWindow -> Property
53many_T_rows (MockWindow w h) = liftIOResult $ do
54many_T_rows (MockWindow w h) = liftIOResult $ do
54− (mock_data, t) <- mock_terminal (DisplayRegion w h)
55+ (mock_data, t) <- mock_terminal (w,h)
55 dc <- display_bounds t >>= display_context t
56 dc <- display_bounds t >>= display_context t
56 -- create an image that contains the character 'T' repeated for all the rows
57 -- create an image that contains the character 'T' repeated for all the rows
57 let i = vert_cat $ replicate (fromEnum h) $ horiz_cat $ replicate (fromEnum w) (char def_attr 'T')
58 let i = vert_cat $ replicate (fromEnum h) $ horiz_cat $ replicate (fromEnum w) (char def_attr 'T')
@@ -64,7 +65,7 @@ many_T_rows (MockWindow w h) = liftIOResult $ do
64
65
65many_T_rows_cropped_width :: MockWindow -> Property
66many_T_rows_cropped_width :: MockWindow -> Property
66many_T_rows_cropped_width (MockWindow w h) = liftIOResult $ do
67many_T_rows_cropped_width (MockWindow w h) = liftIOResult $ do
67− (mock_data,t) <- mock_terminal (DisplayRegion w h)
68+ (mock_data,t) <- mock_terminal (w,h)
68 dc <- display_bounds t >>= display_context t
69 dc <- display_bounds t >>= display_context t
69 -- create an image that contains the character 'T' repeated for all the rows
70 -- create an image that contains the character 'T' repeated for all the rows
70 let i = vert_cat $ replicate (fromEnum h) $ horiz_cat $ replicate (fromEnum w * 2) (char def_attr 'T')
71 let i = vert_cat $ replicate (fromEnum h) $ horiz_cat $ replicate (fromEnum w * 2) (char def_attr 'T')
@@ -77,7 +78,7 @@ many_T_rows_cropped_width (MockWindow w h) = liftIOResult $ do
77
78
78many_T_rows_cropped_height :: MockWindow -> Property
79many_T_rows_cropped_height :: MockWindow -> Property
79many_T_rows_cropped_height (MockWindow w h) = liftIOResult $ do
80many_T_rows_cropped_height (MockWindow w h) = liftIOResult $ do
80− (mock_data,t) <- mock_terminal (DisplayRegion w h)
81+ (mock_data,t) <- mock_terminal (w,h)
81 dc <- display_bounds t >>= display_context t
82 dc <- display_bounds t >>= display_context t
82 -- create an image that contains the character 'T' repeated for all the rows
83 -- create an image that contains the character 'T' repeated for all the rows
83 let i = vert_cat $ replicate (fromEnum h * 2) $ horiz_cat $ replicate (fromEnum w) (char def_attr 'T')
84 let i = vert_cat $ replicate (fromEnum h * 2) $ horiz_cat $ replicate (fromEnum w) (char def_attr 'T')
test/interactive_terminal_test.hs+5−6
@@ -5,8 +5,7 @@ import Graphics.Vty
5import Graphics.Vty.Attributes
5import Graphics.Vty.Attributes
6import Graphics.Vty.Inline
6import Graphics.Vty.Inline
7import Graphics.Vty.Picture
7import Graphics.Vty.Picture
8−import Graphics.Vty.Terminal
8+import Graphics.Vty.Output
9−import Graphics.Vty.DisplayRegion
10
9
11import Control.Concurrent (threadDelay)
10import Control.Concurrent (threadDelay)
12import Control.Exception
11import Control.Exception
@@ -224,7 +223,7 @@ display_bounds_test_0 = Test
224 , test_action = do
223 , test_action = do
225 t <- current_terminal
224 t <- current_terminal
226 reserve_display t
225 reserve_display t
227− DisplayRegion w h <- display_bounds t
226+ (w,h) <- display_bounds t
228 let row_0 = replicate (fromEnum w) 'X' ++ "\n"
227 let row_0 = replicate (fromEnum w) 'X' ++ "\n"
229 row_h = replicate (fromEnum w - 1) 'X'
228 row_h = replicate (fromEnum w - 1) 'X'
230 row_n = "X" ++ replicate (fromEnum w - 2) ' ' ++ "X\n"
229 row_n = "X" ++ replicate (fromEnum w - 2) ' ' ++ "X\n"
@@ -245,7 +244,7 @@ display_bounds_test_1 = Test
245 , test_action = do
244 , test_action = do
246 t <- current_terminal
245 t <- current_terminal
247 reserve_display t
246 reserve_display t
248− DisplayRegion w h <- display_bounds t
247+ (w,h) <- display_bounds t
249 set_cursor_pos t 0 0
248 set_cursor_pos t 0 0
250 let row_0 = replicate (fromEnum w) 'X' ++ "\n"
249 let row_0 = replicate (fromEnum w) 'X' ++ "\n"
251 putStr row_0
250 putStr row_0
@@ -274,7 +273,7 @@ display_bounds_test_2 = Test
274 , test_action = do
273 , test_action = do
275 t <- current_terminal
274 t <- current_terminal
276 reserve_display t
275 reserve_display t
277− bounds@(DisplayRegion w h) <- display_bounds t
276+ bounds@(w,h) <- display_bounds t
278 let first_row = horiz_cat $ replicate (fromEnum w) (char def_attr 'X')
277 let first_row = horiz_cat $ replicate (fromEnum w) (char def_attr 'X')
279 middle_rows = vert_cat $ replicate (fromEnum h - 2) middle_row
278 middle_rows = vert_cat $ replicate (fromEnum h - 2) middle_row
280 middle_row = (char def_attr 'X') <|> background_fill (w - 2) 1 <|> (char def_attr 'X')
279 middle_row = (char def_attr 'X') <|> background_fill (w - 2) 1 <|> (char def_attr 'X')
@@ -297,7 +296,7 @@ display_bounds_test_3 = Test
297 , test_action = do
296 , test_action = do
298 t <- current_terminal
297 t <- current_terminal
299 reserve_display t
298 reserve_display t
300− DisplayRegion w h <- display_bounds t
299+ (w,h) <- display_bounds t
301 hide_cursor t
300 hide_cursor t
302 set_cursor_pos t 0 0
301 set_cursor_pos t 0 0
303 let row_0 = replicate (fromEnum w) 'X'
302 let row_0 = replicate (fromEnum w) 'X'
vty.cabal+19−19
@@ -65,7 +65,8 @@ library
65 Graphics.Vty.Input.Internal
65 Graphics.Vty.Input.Internal
66 Graphics.Vty.Input.Terminfo
66 Graphics.Vty.Input.Terminfo
67 Graphics.Vty.Picture
67 Graphics.Vty.Picture
68− Graphics.Vty.Terminal
68+ Graphics.Vty.Prelude
69+ Graphics.Vty.Output
69 Graphics.Text.Width
70 Graphics.Text.Width
70 -- the modules below are only meant to be used by the tests.
71 -- the modules below are only meant to be used by the tests.
71 Codec.Binary.UTF8.Debug
72 Codec.Binary.UTF8.Debug
@@ -73,16 +74,15 @@ library
73 Data.Terminfo.Eval
74 Data.Terminfo.Eval
74 Data.Marshalling
75 Data.Marshalling
75 Graphics.Vty.Debug
76 Graphics.Vty.Debug
76− Graphics.Vty.DisplayRegion
77 Graphics.Vty.DisplayAttributes
77 Graphics.Vty.DisplayAttributes
78 Graphics.Vty.Image.Internal
78 Graphics.Vty.Image.Internal
79 Graphics.Vty.PictureToSpans
79 Graphics.Vty.PictureToSpans
80 Graphics.Vty.Span
80 Graphics.Vty.Span
81− Graphics.Vty.Terminal.Mock
81+ Graphics.Vty.Output.Mock
82− Graphics.Vty.Terminal.Interface
82+ Graphics.Vty.Output.Interface
83− Graphics.Vty.Terminal.MacOSX
83+ Graphics.Vty.Output.MacOSX
84− Graphics.Vty.Terminal.XTermColor
84+ Graphics.Vty.Output.XTermColor
85− Graphics.Vty.Terminal.TerminfoBased
85+ Graphics.Vty.Output.TerminfoBased
86
86
87 other-modules: Graphics.Vty.Attributes.Color
87 other-modules: Graphics.Vty.Attributes.Color
88 Graphics.Vty.Attributes.Color240
88 Graphics.Vty.Attributes.Color240
@@ -139,11 +139,11 @@ test-suite verify-using-mock-terminal
139
139
140 other-modules: Verify
140 other-modules: Verify
141 Verify.Graphics.Vty.Attributes
141 Verify.Graphics.Vty.Attributes
142− Verify.Graphics.Vty.DisplayRegion
142+ Verify.Graphics.Vty.Prelude
143 Verify.Graphics.Vty.Picture
143 Verify.Graphics.Vty.Picture
144 Verify.Graphics.Vty.Image
144 Verify.Graphics.Vty.Image
145 Verify.Graphics.Vty.Span
145 Verify.Graphics.Vty.Span
146− Verify.Graphics.Vty.Terminal
146+ Verify.Graphics.Vty.Output
147
147
148 build-depends: vty,
148 build-depends: vty,
149 Cabal == 1.18.*,
149 Cabal == 1.18.*,
@@ -168,15 +168,15 @@ test-suite verify-terminal
168
168
169 hs-source-dirs: test
169 hs-source-dirs: test
170
170
171− test-module: VerifyTerminal
171+ test-module: VerifyOutput
172
172
173 other-modules: Verify
173 other-modules: Verify
174 Verify.Graphics.Vty.Attributes
174 Verify.Graphics.Vty.Attributes
175− Verify.Graphics.Vty.DisplayRegion
175+ Verify.Graphics.Vty.Prelude
176 Verify.Graphics.Vty.Picture
176 Verify.Graphics.Vty.Picture
177 Verify.Graphics.Vty.Image
177 Verify.Graphics.Vty.Image
178 Verify.Graphics.Vty.Span
178 Verify.Graphics.Vty.Span
179− Verify.Graphics.Vty.Terminal
179+ Verify.Graphics.Vty.Output
180
180
181 build-depends: vty,
181 build-depends: vty,
182 Cabal == 1.18.*,
182 Cabal == 1.18.*,
@@ -205,7 +205,7 @@ test-suite verify-display-attributes
205
205
206 other-modules: Verify
206 other-modules: Verify
207 Verify.Graphics.Vty.Attributes
207 Verify.Graphics.Vty.Attributes
208− Verify.Graphics.Vty.DisplayRegion
208+ Verify.Graphics.Vty.Prelude
209 Verify.Graphics.Vty.Picture
209 Verify.Graphics.Vty.Picture
210 Verify.Graphics.Vty.Image
210 Verify.Graphics.Vty.Image
211 Verify.Graphics.Vty.Span
211 Verify.Graphics.Vty.Span
@@ -261,7 +261,7 @@ test-suite verify-eval-terminfo-caps
261 test-module: VerifyEvalTerminfoCaps
261 test-module: VerifyEvalTerminfoCaps
262
262
263 other-modules: Verify
263 other-modules: Verify
264− Verify.Graphics.Vty.Terminal
264+ Verify.Graphics.Vty.Output
265
265
266 build-depends: vty,
266 build-depends: vty,
267 Cabal == 1.18.*,
267 Cabal == 1.18.*,
@@ -345,7 +345,7 @@ test-suite verify-inline
345 test-module: VerifyInline
345 test-module: VerifyInline
346
346
347 other-modules: Verify
347 other-modules: Verify
348− Verify.Graphics.Vty.Terminal
348+ Verify.Graphics.Vty.Output
349
349
350 build-depends: vty,
350 build-depends: vty,
351 Cabal == 1.18.*,
351 Cabal == 1.18.*,
@@ -373,7 +373,7 @@ test-suite verify-parse-terminfo-caps
373
373
374 other-modules: Verify
374 other-modules: Verify
375 Verify.Data.Terminfo.Parse
375 Verify.Data.Terminfo.Parse
376− Verify.Graphics.Vty.Terminal
376+ Verify.Graphics.Vty.Output
377
377
378 build-depends: vty,
378 build-depends: vty,
379 Cabal == 1.18.*,
379 Cabal == 1.18.*,
@@ -402,7 +402,7 @@ test-suite verify-simple-span-generation
402
402
403 other-modules: Verify
403 other-modules: Verify
404 Verify.Graphics.Vty.Attributes
404 Verify.Graphics.Vty.Attributes
405− Verify.Graphics.Vty.DisplayRegion
405+ Verify.Graphics.Vty.Prelude
406 Verify.Graphics.Vty.Picture
406 Verify.Graphics.Vty.Picture
407 Verify.Graphics.Vty.Image
407 Verify.Graphics.Vty.Image
408 Verify.Graphics.Vty.Span
408 Verify.Graphics.Vty.Span
@@ -434,7 +434,7 @@ test-suite verify-crop-span-generation
434
434
435 other-modules: Verify
435 other-modules: Verify
436 Verify.Graphics.Vty.Attributes
436 Verify.Graphics.Vty.Attributes
437− Verify.Graphics.Vty.DisplayRegion
437+ Verify.Graphics.Vty.Prelude
438 Verify.Graphics.Vty.Picture
438 Verify.Graphics.Vty.Picture
439 Verify.Graphics.Vty.Image
439 Verify.Graphics.Vty.Image
440 Verify.Graphics.Vty.Span
440 Verify.Graphics.Vty.Span
@@ -466,7 +466,7 @@ test-suite verify-layers-span-generation
466
466
467 other-modules: Verify
467 other-modules: Verify
468 Verify.Graphics.Vty.Attributes
468 Verify.Graphics.Vty.Attributes
469− Verify.Graphics.Vty.DisplayRegion
469+ Verify.Graphics.Vty.Prelude
470 Verify.Graphics.Vty.Picture
470 Verify.Graphics.Vty.Picture
471 Verify.Graphics.Vty.Image
471 Verify.Graphics.Vty.Image
472 Verify.Graphics.Vty.Span
472 Verify.Graphics.Vty.Span