packages feed

vty 5.2.10 → 5.2.11

raw patch · 16 files changed

+180/−50 lines, 16 filesdep ~basedep ~deepseq

Dependency ranges changed: base, deepseq

Files

CHANGELOG view
@@ -1,3 +1,17 @@+5.2.12+  - unreleased++5.2.11+  - deepseq bounds increased for tests.+  - Clean up warnings when compiling on 7.10+    - Thanks Eric Mertens+  - Avoid discarding input bytes after multi-byte encoded codepoint+    - Thanks Eric Mertens++5.2.10+  - "str" now returns EmptyImage for empty strings to match behavior of other string-like Image constructors (fixes #74)+    - Thanks Jonathan Daugherty+ 5.2.9   - dependency version bumps     - https://github.com/coreyoconnor/vty/pull/71
src/Data/Terminfo/Eval.hs view
@@ -1,7 +1,13 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# OPTIONS_GHC -funbox-strict-fields #-} {-# OPTIONS_HADDOCK hide #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ {- Evaluates the paramaterized terminfo string capability with the given parameters.  -  -}@@ -17,10 +23,13 @@ import Control.Monad.Writer  import Data.Bits ((.|.), (.&.), xor)-import Data.List -import Data.Word +import Data.List  import qualified Data.Vector.Unboxed as Vector++#if !(MIN_VERSION_base(4,8,0))+import Data.Word+#endif  -- | capability evaluator state data EvalState = EvalState
src/Data/Terminfo/Parse.hs view
@@ -1,8 +1,14 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} {-# OPTIONS_HADDOCK hide #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE NamedFieldPuns #-} {-# OPTIONS_GHC -funbox-strict-fields -O #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ module Data.Terminfo.Parse ( module Data.Terminfo.Parse                            , Text.Parsec.ParseError                            )@@ -11,13 +17,16 @@ import Control.Monad ( liftM ) import Control.DeepSeq -import Data.Monoid import Data.Word import qualified Data.Vector.Unboxed as Vector  import Numeric (showHex)  import Text.Parsec++#if !(MIN_VERSION_base(4,8,0))+import Data.Monoid+#endif  data CapExpression = CapExpression     { capOps :: !CapOps
src/Graphics/Vty/Attributes.hs view
@@ -1,6 +1,12 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ -- | Display attributes -- -- Typically the values 'defAttr' or 'currentAttr' are modified to form attributes:@@ -33,11 +39,14 @@  import Data.Bits import Data.Default-import Data.Monoid import Data.Word  import Graphics.Vty.Attributes.Color import Graphics.Vty.Attributes.Color240++#if !(MIN_VERSION_base(4,8,0))+import Data.Monoid+#endif  -- | A display attribute defines the Color and Style of all the characters rendered after the -- attribute is applied.
src/Graphics/Vty/DisplayAttributes.hs view
@@ -1,12 +1,21 @@ -- Copyright 2009-2010 Corey O'Connor+{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ module Graphics.Vty.DisplayAttributes     where  import Graphics.Vty.Attributes  import Data.Bits ((.&.))++#if !(MIN_VERSION_base(4,8,0)) import Data.Monoid (Monoid(..), mconcat)+#endif  -- | Given the previously applied display attributes as a FixedAttr and the current display -- attributes as an Attr produces a FixedAttr that represents the current display attributes. This
src/Graphics/Vty/Image/Internal.hs view
@@ -1,5 +1,11 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE NamedFieldPuns #-} {-# OPTIONS_HADDOCK hide #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ module Graphics.Vty.Image.Internal where  import Graphics.Vty.Attributes@@ -7,8 +13,11 @@  import Control.DeepSeq -import Data.Monoid import qualified Data.Text.Lazy as TL++#if !(MIN_VERSION_base(4,8,0))+import Data.Monoid+#endif  -- | A display text is a Data.Text.Lazy --
src/Graphics/Vty/Inline.hs view
@@ -24,7 +24,13 @@ -- 'putAttrChange' -- -- Copyright 2009-2010 Corey O'Connor+{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ module Graphics.Vty.Inline ( module Graphics.Vty.Inline                            , withVty                            )@@ -37,14 +43,17 @@  import Blaze.ByteString.Builder (writeToByteString) -import Control.Applicative import Control.Monad.State.Strict  import Data.Bits ( (.&.), complement ) import Data.IORef-import Data.Monoid ( mappend )  import System.IO++#if !(MIN_VERSION_base(4,8,0))+import Control.Applicative+import Data.Monoid ( mappend )+#endif  type InlineM v = State Attr v 
src/Graphics/Vty/Inline/Unsafe.hs view
@@ -1,11 +1,14 @@ {-# LANGUAGE CPP #-} {-# OPTIONS_HADDOCK hide #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ module Graphics.Vty.Inline.Unsafe where  import Graphics.Vty -import Control.Applicative- import Data.Default import Data.Monoid import Data.IORef@@ -17,6 +20,10 @@ import System.IO.Unsafe  import System.Posix.IO (handleToFd)++#if !(MIN_VERSION_base(4,8,0))+import Control.Applicative+#endif  globalVty :: IORef (Maybe Vty) {-# NOINLINE globalVty #-}
src/Graphics/Vty/Input.hs view
@@ -1,4 +1,10 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE RecordWildCards #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ -- | The input layer for VTY. This provides methods for initializing an 'Input' structure which can -- then be used to read 'Event's from the terminal. --@@ -133,11 +139,13 @@ import Control.Concurrent import Control.Lens -import Data.Functor ((<$>))-import Data.Monoid- import qualified System.Console.Terminfo as Terminfo import System.Posix.Signals.Exts++#if !(MIN_VERSION_base(4,8,0))+import Data.Functor ((<$>))+import Data.Monoid+#endif  -- | Set up the terminal with file descriptor `inputFd` for input.  Returns a 'Input'. --
src/Graphics/Vty/Input/Classify.hs view
@@ -60,14 +60,21 @@ classify table =     let standardClassifier = compile table     in \s -> case s of-        (c:_) | ord c >= 0xC2 && utf8Length (ord c) > length s -> Prefix -- beginning of an utf8 sequence-        (c:_) | ord c >= 0xC2 -> classifyUtf8 s -- As soon as-        _ -> standardClassifier s+        c:cs | ord c >= 0xC2 -> classifyUtf8 c cs+        _                    -> standardClassifier s -classifyUtf8 :: [Char] -> KClass-classifyUtf8 s = case decode ((map (fromIntegral . ord) s) :: [Word8]) of-    Just (unicodeChar, _) -> Valid (EvKey (KChar unicodeChar) []) []-    _ -> Invalid -- something bad happened; just ignore and continue.+classifyUtf8 :: Char -> [Char] -> KClass+classifyUtf8 c cs =+  let n = utf8Length (ord c)+      (codepoint,rest) = splitAt n (c:cs)++      codepoint8 :: [Word8]+      codepoint8 = map (fromIntegral . ord) codepoint++  in case decode codepoint8 of+       _ | n < length codepoint -> Prefix+       Just (unicodeChar, _)    -> Valid (EvKey (KChar unicodeChar) []) rest+       Nothing                  -> Invalid -- something bad happened; just ignore and continue.  utf8Length :: (Num t, Ord a, Num a) => a -> t utf8Length c
src/Graphics/Vty/Output.hs view
@@ -1,5 +1,11 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE NamedFieldPuns #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ --  | Output interface. -- --  Access to the current terminal or a specific terminal device.@@ -40,10 +46,11 @@  import Control.Monad.Trans -import Data.Monoid (mappend) import Data.List (isPrefixOf) -import System.Posix.Env (getEnv)+#if !(MIN_VERSION_base(4,8,0))+import Data.Monoid (mappend)+#endif  -- | Returns a `Output` for the terminal specified in `Config` --
src/Graphics/Vty/Output/Interface.hs view
@@ -1,10 +1,16 @@ -- Copyright Corey O'Connor -- General philosophy is: MonadIO is for equations exposed to clients.+{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE FlexibleContexts #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ module Graphics.Vty.Output.Interface where @@ -23,15 +29,18 @@  import qualified Data.ByteString as BS import Data.IORef-import Data.Monoid (mempty, mappend) import qualified Data.Text.Encoding as T import qualified Data.Text.Lazy as TL import qualified Data.Vector as Vector +#if !(MIN_VERSION_base(4,8,0))+import Data.Monoid (mempty, mappend)+#endif+ data Output = Output     { -- | Text identifier for the output device. Used for debugging.        terminalID :: String-    , releaseTerminal :: MonadIO m => m ()+    , releaseTerminal :: forall m. MonadIO m => m ()     -- | Clear the display and initialize the terminal to some initial display state.      --     -- The expectation of a program is that the display starts in some initial state. @@ -46,12 +55,12 @@     --     --  - The previous state cannot be determined     --  - When exclusive access to a display is released the display returns to the previous state.-    , reserveDisplay :: MonadIO m => m ()+    , reserveDisplay :: forall m. MonadIO m => m ()     -- | Return the display to the state before `reserveDisplay`     -- If no previous state then set the display state to the initial state.-    , releaseDisplay :: MonadIO m => m ()+    , releaseDisplay :: forall m. MonadIO m => m ()     -- | Returns the current display bounds.-    , displayBounds :: MonadIO m => m DisplayRegion+    , displayBounds :: forall m. MonadIO m => m DisplayRegion     -- | Output the byte string to the terminal device.     , outputByteBuffer :: BS.ByteString -> IO ()     -- | Maximum number of colors supported by the context.@@ -62,7 +71,7 @@     -- | Acquire display access to the given region of the display.     -- Currently all regions have the upper left corner of (0,0) and the lower right corner at      -- (max displayWidth providedWidth, max displayHeight providedHeight)-    , mkDisplayContext :: MonadIO m => Output -> DisplayRegion -> m DisplayContext+    , mkDisplayContext :: forall m. MonadIO m => Output -> DisplayRegion -> m DisplayContext     }  displayContext :: MonadIO m => Output -> DisplayRegion -> m DisplayContext
src/Graphics/Vty/Output/TerminfoBased.hs view
@@ -3,6 +3,11 @@ {-# LANGUAGE FlexibleInstances #-} {-# OPTIONS_GHC -D_XOPEN_SOURCE=500 -fno-warn-warnings-deprecations #-} {-# CFILES gwinsz.c #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ -- |  Terminfo based terminal handling. -- -- The color handling assumes tektronix like. No HP support provided. If the terminal is not one I@@ -28,10 +33,8 @@ import Control.Monad.Trans  import Data.Bits ((.&.))-import Data.Foldable (foldMap) import Data.IORef import Data.Maybe (isJust, isNothing, fromJust)-import Data.Monoid import Data.Word  import Foreign.C.Types ( CInt(..), CLong(..) )@@ -41,6 +44,11 @@ import qualified System.Console.Terminfo as Terminfo import System.Posix.IO (fdWriteBuf) import System.Posix.Types (Fd(..))++#if !(MIN_VERSION_base(4,8,0))+import Data.Foldable (foldMap)+import Data.Monoid+#endif  data TerminfoCaps = TerminfoCaps      { smcup :: Maybe CapExpression
src/Graphics/Vty/Output/XTermColor.hs view
@@ -1,3 +1,9 @@+{-# LANGUAGE CPP #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ -- Copyright 2009-2010 Corey O'Connor module Graphics.Vty.Output.XTermColor ( reserveTerminal )     where@@ -8,14 +14,16 @@ import Blaze.ByteString.Builder (writeToByteString) import Blaze.ByteString.Builder.Word (writeWord8) -import Control.Applicative import Control.Monad (void) import Control.Monad.Trans -import Data.Foldable (foldMap)- import System.Posix.IO (fdWrite) import System.Posix.Types (Fd)++#if !(MIN_VERSION_base(4,8,0))+import Control.Applicative+import Data.Foldable (foldMap)+#endif  -- | Initialize the display to UTF-8.  reserveTerminal :: ( Applicative m, MonadIO m ) => String -> Fd -> m Output
src/Graphics/Vty/PictureToSpans.hs view
@@ -5,6 +5,11 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TemplateHaskell #-}++#ifndef MIN_VERSION_base+#defined MIN_VERSION_base(x,y,z) 1+#endif+ {- | Transforms an image into rows of operations.  -} module Graphics.Vty.PictureToSpans where@@ -27,11 +32,14 @@ #endif  import qualified Data.Vector as Vector hiding ( take, replicate )-import Data.Monoid (mappend) import Data.Vector.Mutable ( MVector(..)) import qualified Data.Vector.Mutable as MVector  import qualified Data.Text.Lazy as TL++#if !(MIN_VERSION_base(4,8,0))+import Data.Monoid (mappend)+#endif  type MRowOps s = MVector s SpanOps 
vty.cabal view
@@ -1,5 +1,5 @@ name:                vty-version:             5.2.10+version:             5.2.11 license:             BSD3 license-file:        LICENSE author:              AUTHORS@@ -142,7 +142,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        unix,@@ -174,7 +174,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        terminfo >= 0.3 && < 0.5,@@ -208,7 +208,7 @@                        bytestring,                        containers,                        data-default >= 0.5.3,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        terminfo >= 0.3 && < 0.5,                        text >= 0.11.3,@@ -241,7 +241,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        unix,@@ -267,7 +267,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        unix,@@ -295,7 +295,7 @@                        blaze-builder >= 0.3.3.2 && < 0.5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        terminfo >= 0.3 && < 0.5,                        text >= 0.11.3,@@ -324,7 +324,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        unix,@@ -352,7 +352,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        unix,@@ -379,7 +379,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        unix,@@ -407,7 +407,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        terminfo >= 0.3 && < 0.5,                        text >= 0.11.3,@@ -439,7 +439,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        unix,@@ -471,7 +471,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        unix,@@ -503,7 +503,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        unix,@@ -529,7 +529,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        mtl >= 1.1.1.0 && < 2.3,                        text >= 0.11.3,                        unix,@@ -558,7 +558,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        lens >= 3.9.0.2 && < 5.0,                        mtl >= 1.1.1.0 && < 2.3,                        terminfo >= 0.3 && < 0.5,@@ -593,7 +593,7 @@                        base >= 4 && < 5,                        bytestring,                        containers,-                       deepseq >= 1.1 && < 1.4,+                       deepseq >= 1.1 && < 1.5,                        lens >= 3.9.0.2 && < 5.0,                        mtl >= 1.1.1.0 && < 2.3,                        string-qq,