packages feed

vty 5.33 → 5.34

raw patch · 6 files changed

+46/−42 lines, 6 files

Files

CHANGELOG.md view
@@ -1,4 +1,33 @@ +5.34+----++API changes:+ * Added an `NFData` instance for `Event` (thanks Mario Lang)+ * Removed `Monoid` and `Semigroup` instances for `Attr` and+   `MaybeDefault`. This change removed the instances because they were+   misbehaved; merging `Attr` and `MaybeDefault` values with these+   instances resulted in field value losses. For example, before this+   change,+```+(defAttr `withForeColor` blue) <> (defAttr `withBackColor` green)+```+   would result in just+```+   (defAttr `withBackColor` green)+```+   because the instances were designed to favor the right-hand+   arguments' fields even if they had not been explicitly set+   (a consequence of the `MaybeDefault` `Semigroup` instance).+   While that behavior was sensible specifically in the context of+   `Graphics.Vty.Inline`, it wasn't a useful user-facing API and it made+   for surprising instance behavior. Since there is actually no good way+   to handle this in a `Semigroup` instance for `Attr` -- some choices+   have to be made about how to merge two attributes' foreground colors,+   and that won't be much better than what we had -- the instance was+   just removed.++ 5.33 ---- 
src/Graphics/Vty/Attributes.hs view
@@ -61,9 +61,6 @@  import Control.DeepSeq import Data.Bits-#if !(MIN_VERSION_base(4,11,0))-import Data.Semigroup-#endif import Data.Text (Text) import Data.Word import GHC.Generics@@ -116,19 +113,6 @@ --  Then the foreground color encoded into 8 bits. --  Then the background color encoded into 8 bits. -instance Semigroup Attr where-    attr0 <> attr1 =-        Attr ( attrStyle attr0     <> attrStyle attr1 )-             ( attrForeColor attr0 <> attrForeColor attr1 )-             ( attrBackColor attr0 <> attrBackColor attr1 )-             ( attrURL attr0       <> attrURL attr1 )--instance Monoid Attr where-    mempty = Attr mempty mempty mempty mempty-#if !(MIN_VERSION_base(4,11,0))-    mappend = (<>)-#endif- -- | Specifies the display attributes such that the final style and -- color values do not depend on the previously applied display -- attribute. The display attributes can still depend on the terminal's@@ -150,23 +134,6 @@     rnf Default = ()     rnf KeepCurrent = ()     rnf (SetTo v) = rnf v--instance Eq v => Semigroup (MaybeDefault v) where-    Default     <> Default     = Default-    Default     <> KeepCurrent = Default-    Default     <> SetTo v     = SetTo v-    KeepCurrent <> Default     = Default-    KeepCurrent <> KeepCurrent = KeepCurrent-    KeepCurrent <> SetTo v     = SetTo v-    SetTo _v    <> Default     = Default-    SetTo v     <> KeepCurrent = SetTo v-    SetTo _     <> SetTo v     = SetTo v--instance Eq v => Monoid ( MaybeDefault v ) where-    mempty = KeepCurrent-#if !(MIN_VERSION_base(4,11,0))-    mappend = (<>)-#endif  -- | Styles are represented as an 8 bit word. Each bit in the word is 1 -- if the style attribute assigned to that bit should be applied and 0
src/Graphics/Vty/Inline.hs view
@@ -56,13 +56,13 @@ -- | Set the background color to the provided 'Color'. backColor :: Color -> InlineM () backColor c = modify $ \s ->-    s { inlineAttr = inlineAttr s `mappend` (currentAttr `withBackColor` c)+    s { inlineAttr = inlineAttr s `withBackColor` c       }  -- | Set the foreground color to the provided 'Color'. foreColor :: Color -> InlineM () foreColor c = modify $ \s ->-    s { inlineAttr = inlineAttr s `mappend` (currentAttr `withForeColor` c)+    s { inlineAttr = inlineAttr s `withForeColor` c       }  -- | Attempt to change the 'Style' of the following text..@@ -71,7 +71,7 @@ -- produced. The style can still be removed. applyStyle :: Style -> InlineM () applyStyle st = modify $ \s ->-    s { inlineAttr = inlineAttr s `mappend` (currentAttr `withStyle` st)+    s { inlineAttr = inlineAttr s `withStyle` st       }  -- | Attempt to remove the specified 'Style' from the display of the
src/Graphics/Vty/Input/Events.hs view
@@ -1,6 +1,7 @@ {-# Language DeriveGeneric #-} module Graphics.Vty.Input.Events where +import Control.DeepSeq import Data.ByteString import GHC.Generics @@ -21,16 +22,22 @@          | KHome | KPageUp | KDel | KEnd | KPageDown | KBegin | KMenu     deriving (Eq,Show,Read,Ord,Generic) +instance NFData Key+ -- | Modifier keys. Key codes are interpreted such that users are more -- likely to have Meta than Alt; for instance on the PC Linux console, -- 'MMeta' will generally correspond to the physical Alt key. data Modifier = MShift | MCtrl | MMeta | MAlt     deriving (Eq,Show,Read,Ord,Generic) +instance NFData Modifier+ -- | Mouse buttons. data Button = BLeft | BMiddle | BRight | BScrollUp | BScrollDown     deriving (Eq,Show,Read,Ord,Generic) +instance NFData Button+ -- | Events. data Event     = EvKey Key [Modifier]@@ -61,5 +68,7 @@     | EvGainedFocus     -- ^ The terminal running the application gained input focus.     deriving (Eq,Show,Read,Ord,Generic)++instance NFData Event  type ClassifyMap = [(String,Event)]
src/Graphics/Vty/Picture.hs view
@@ -79,9 +79,6 @@ data Cursor =     -- | Hide the cursor     NoCursor-    -- | Show the cursor at the given logical column accounting for-    -- character width in the presence of multi-column characters.-    | PositionOnly !Bool !Int !Int     -- | Set the terminal's cursor position without displaying a cursor     -- character. This is important for accessibility with screen     -- readers where a cursor position needs to be reported but we may@@ -89,6 +86,9 @@     -- reasons. The boolean argument indicates whether the positioning     -- should be absolute as with 'AbsoluteCursor' ('True') or logical     -- as with 'Cursor' ('False').+    | PositionOnly !Bool !Int !Int+    -- | Show the cursor at the given logical column accounting for+    -- character width in the presence of multi-column characters.     | Cursor !Int !Int     -- | Show the cursor at the given absolute terminal column and row     | AbsoluteCursor !Int !Int
vty.cabal view
@@ -1,5 +1,5 @@ name:                vty-version:             5.33+version:             5.34 license:             BSD3 license-file:        LICENSE author:              AUTHORS@@ -543,7 +543,7 @@   build-depends:       vty,                        Cabal >= 1.20,                        QuickCheck >= 2.7,-                       random >= 1.0 && < 1.2,+                       random >= 1.0 && < 1.3,                        base >= 4.8 && < 5,                        bytestring,                        containers,@@ -553,7 +553,6 @@                        unix,                        utf8-string >= 0.3 && < 1.1,                        vector >= 0.7-  test-suite verify-utf8-width   default-language:    Haskell2010