1{-# LANGUAGE BangPatterns #-}
2-- | The Picture data structure is representative of the final terminal view.
4-- This module re-exports most of the Graphics.Vty.Image and Graphics.Vty.Attributes modules.
6-- Copyright 2009-2010 Corey O'Connor
7module Graphics.Vty.Picture ( module Graphics.Vty.Picture
26 -- | The possible display attributes used in constructing an `Image`.
27 , module Graphics.Vty.Attributes
31import Graphics.Vty.Attributes
32import Graphics.Vty.Image
36-- | The type of images to be displayed using 'update'.
37-- Can be constructed directly or using `pic_for_image`. Which provides an initial instance with
38-- reasonable defaults for pic_cursor and pic_background.
40 { pic_cursor :: Cursor
42 , pic_background :: Background
45instance Show Picture where
46 show (Picture _ image _ ) = "Picture ?? " ++ show image ++ " ??"
48instance NFData Picture where
49 rnf (Picture c i b) = c `deepseq` i `deepseq` b `deepseq` ()
51-- | Create a picture for display for the given image. The picture will not have a displayed cursor
52-- and the background display attribute will be `current_attr`.
53pic_for_image :: Image -> Picture
54pic_for_image i = Picture
55 { pic_cursor = NoCursor
57 , pic_background = Background ' ' current_attr
60-- | A picture can be configured either to not show the cursor or show the cursor at the specified
63-- There is not a 1 to 1 map from character positions to a row and column on the screen due to
64-- characters that take more than 1 column.
66-- todo: The Cursor can be given a (character,row) offset outside of the visible bounds of the
67-- output region. In this case the cursor will not be shown.
72instance NFData Cursor where
74 rnf (Cursor w h) = w `seq` h `seq` ()
76-- | Unspecified regions are filled with the picture's background pattern. The background pattern
77-- can specify a character and a display attribute. If the display attribute used previously should
78-- be used for a background fill then use `current_attr` for the background attribute. This is the
79-- default background display attribute.
81-- \todo The current attribute is always set to the default attributes at the start of updating the
82-- screen to a picture.
84-- \todo The background character *must* occupy a single column and no more.
86-- \todo background char should be optional
87data Background = Background
88 { background_char :: Char
89 , background_attr :: Attr
92instance NFData Background where
93 rnf (Background c a) = c `seq` a `seq` ()
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list