vty 4.7.0.4 → 4.7.0.6
raw patch · 6 files changed
+36/−28 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Graphics.Vty.Attributes: black :: Color
- Graphics.Vty.Attributes: blink :: Style
- Graphics.Vty.Attributes: blue :: Color
- Graphics.Vty.Attributes: bold :: Style
- Graphics.Vty.Attributes: bright_black :: Color
- Graphics.Vty.Attributes: bright_blue :: Color
- Graphics.Vty.Attributes: bright_cyan :: Color
- Graphics.Vty.Attributes: bright_green :: Color
- Graphics.Vty.Attributes: bright_magenta :: Color
- Graphics.Vty.Attributes: bright_red :: Color
- Graphics.Vty.Attributes: bright_white :: Color
- Graphics.Vty.Attributes: bright_yellow :: Color
- Graphics.Vty.Attributes: cyan :: Color
- Graphics.Vty.Attributes: dim :: Style
- Graphics.Vty.Attributes: green :: Color
- Graphics.Vty.Attributes: instance (Eq v, Show v) => Show (MaybeDefault v)
- Graphics.Vty.Attributes: magenta :: Color
- Graphics.Vty.Attributes: red :: Color
- Graphics.Vty.Attributes: reverse_video :: Style
- Graphics.Vty.Attributes: standout :: Style
- Graphics.Vty.Attributes: underline :: Style
- Graphics.Vty.Attributes: white :: Color
- Graphics.Vty.Attributes: yellow :: Color
+ Graphics.Vty.Attributes: black, white, cyan, magenta, blue, yellow, green, red :: Color
+ Graphics.Vty.Attributes: bright_black, bright_yellow, bright_green, bright_red :: Color
+ Graphics.Vty.Attributes: bright_blue, bright_white, bright_cyan, bright_magenta :: Color
+ Graphics.Vty.Attributes: instance Eq v => Show (MaybeDefault v)
+ Graphics.Vty.Attributes: standout, bold, dim, blink, reverse_video, underline :: Style
- Graphics.Vty.Attributes: data Eq v => MaybeDefault v
+ Graphics.Vty.Attributes: data MaybeDefault v
Files
- cbits/mk_wcwidth.c +3/−3
- src/Graphics/Vty/Attributes.hs +10/−2
- src/Graphics/Vty/Image.hs +3/−4
- src/Graphics/Vty/Span.hs +19/−17
- test/Makefile +0/−1
- vty.cabal +1/−1
cbits/mk_wcwidth.c view
@@ -187,7 +187,7 @@ /* if we arrive here, ucs is not a combining or C0/C1 control character */ - return 1 + + return 1 + (ucs >= 0x1100 && (ucs <= 0x115f || /* Hangul Jamo init. consonants */ ucs == 0x2329 || ucs == 0x232a ||@@ -208,7 +208,7 @@ { int w, width = 0; - for (;*pwcs && n-- > 0; pwcs++)+ for (;n-- > 0; pwcs++) if ((w = mk_wcwidth(*pwcs)) < 0) return -1; else@@ -299,7 +299,7 @@ { int w, width = 0; - for (;*pwcs && n-- > 0; pwcs++)+ for (;n-- > 0; pwcs++) if ((w = mk_wcwidth_cjk(*pwcs)) < 0) return -1; else
src/Graphics/Vty/Attributes.hs view
@@ -1,3 +1,6 @@+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE RankNTypes #-} -- Copyright 2009-2010 Corey O'Connor -- Display attributes --@@ -69,8 +72,13 @@ -- | The style and color attributes can either be the terminal defaults. Or be equivalent to the -- previously applied style. Or be a specific value.-data Eq v => MaybeDefault v = Default | KeepCurrent | SetTo !v- deriving ( Eq, Show )+data MaybeDefault v where+ Default :: MaybeDefault v+ KeepCurrent :: MaybeDefault v+ SetTo :: forall v . ( Eq v, Show v ) => !v -> MaybeDefault v++deriving instance Eq v => Eq (MaybeDefault v)+deriving instance Eq v => Show (MaybeDefault v) instance Eq v => Monoid ( MaybeDefault v ) where mempty = KeepCurrent
src/Graphics/Vty/Image.hs view
@@ -366,11 +366,10 @@ crop :: (Word, Word) -> Image -> Image crop (0,_) _ = EmptyImage crop (_,0) _ = EmptyImage-crop v (ImageCrop _size i) = ImagePad (min (fst v) (fst _size), min (snd v) (snd _size)) i-crop v (ImagePad _size i) = ImagePad (min (fst v) (fst _size), min (snd v) (snd _size)) i-crop v i = ImagePad v i+crop v (ImageCrop _size i) = ImageCrop (min (fst v) (fst _size), min (snd v) (snd _size)) i+crop v i = ImageCrop v i --- | Ensure an image is at least the provided size. If the image is smaler then pad.+-- | Ensure an image is at least the provided size. If the image is smaller then pad. pad :: (Word, Word) -> Image -> Image pad (0,_) _ = EmptyImage pad (_,0) _ = EmptyImage
src/Graphics/Vty/Span.hs view
@@ -136,6 +136,7 @@ (0,0) 0 (region_width region)+ (fromEnum $ region_height region) -- Fill in any unspecified columns with the background pattern. forM_ [0 .. (fromEnum $ region_height region - 1)] $! \row -> do end_x <- Vector.read mrow_ops row >>= return . span_ops_effected_columns@@ -145,7 +146,7 @@ else return () return mrow_ops -row_ops_for_image :: MRowOps s -> Image -> Background -> DisplayRegion -> (Word, Word) -> Int -> Word -> ST s (Word, Word)+row_ops_for_image :: MRowOps s -> Image -> Background -> DisplayRegion -> (Word, Word) -> Int -> Word -> Int -> ST s (Word, Word) row_ops_for_image mrow_ops -- the image to output the ops to image -- the image to rasterize in column order to mrow_ops bg -- the background fill@@ -153,7 +154,9 @@ skip_dim@(skip_row,skip_col) -- the number of rows y -- ??? remaining_columns -- ???+ remain_rows | remaining_columns == 0 = return skip_dim+ | remain_rows == 0 = return skip_dim | y >= fromEnum (region_height region) = return skip_dim | otherwise = case image of EmptyImage -> return skip_dim@@ -174,30 +177,31 @@ skip_dim y remaining_columns+ remain_rows+ let top_height = (fromEnum $! image_height top_image) - (fromEnum $! skip_row - skip_row') (skip_row'',skip_col'') <- row_ops_for_image mrow_ops bottom_image bg region (skip_row', skip_col) - (y + (fromEnum $! image_height top_image) - (fromEnum $! skip_row - skip_row')) + (y + top_height) remaining_columns+ (remain_rows - top_height) return (skip_row'', min skip_col' skip_col'') HorizJoin l r _ _ -> do- (skip_row',skip_col') <- row_ops_for_image mrow_ops l bg region skip_dim y remaining_columns+ (skip_row',skip_col') <- row_ops_for_image mrow_ops l bg region skip_dim y remaining_columns remain_rows -- Don't output the right part unless there is at least a single column left after -- outputting the left part. if image_width l - (skip_col - skip_col') > remaining_columns then return (skip_row,skip_col') else do- (skip_row'',skip_col'') <- row_ops_for_image mrow_ops r bg region (skip_row, skip_col') y (remaining_columns - image_width l + (skip_col - skip_col'))+ (skip_row'',skip_col'') <- row_ops_for_image mrow_ops r bg region (skip_row, skip_col') y (remaining_columns - image_width l + (skip_col - skip_col')) remain_rows return (min skip_row' skip_row'', skip_col'') BGFill width height -> do let min_height = if y + (fromEnum height) > (fromEnum $! region_height region) then region_height region - (toEnum y)- else height- min_width = if width > remaining_columns- then remaining_columns- else width+ else min height (toEnum remain_rows)+ min_width = min width remaining_columns actual_height = if skip_row > min_height then 0 else min_height - skip_row@@ -216,25 +220,23 @@ if dx < 0 -- Translation left -- Extract the delta and add it to skip_col.- then row_ops_for_image mrow_ops (translate (0, dy) i) bg region (skip_row, skip_col + dw) y remaining_columns+ then row_ops_for_image mrow_ops (translate (0, dy) i) bg region (skip_row, skip_col + dw) y remaining_columns remain_rows -- Translation right else if dy < 0 -- Translation up -- Extract the delta and add it to skip_row.- then row_ops_for_image mrow_ops (translate (dx, 0) i) bg region (skip_row + dh, skip_col) y remaining_columns+ then row_ops_for_image mrow_ops (translate (dx, 0) i) bg region (skip_row + dh, skip_col) y remaining_columns remain_rows -- Translation down -- Pad the start of lines and above the image with a- -- background_fill image.- else row_ops_for_image mrow_ops (background_fill ow dh <-> (background_fill dw ih <|> i)) bg region skip_dim y remaining_columns+ -- background_fill image+ else row_ops_for_image mrow_ops (background_fill ow dh <-> (background_fill dw ih <|> i)) bg region skip_dim y remaining_columns remain_rows where dw = toEnum $ abs dx dh = toEnum $ abs dy ow = image_width image ih = image_height i ImageCrop (max_w,max_h) i ->- if y >= fromEnum max_h- then return skip_dim- else row_ops_for_image mrow_ops i bg region skip_dim y (min remaining_columns max_w)+ row_ops_for_image mrow_ops i bg region skip_dim y (min remaining_columns max_w) (min remain_rows $ fromEnum max_h) ImagePad (min_w,min_h) i -> do let hpad = if image_width i < min_w then background_fill (min_w - image_width i) (image_height i)@@ -242,7 +244,7 @@ let vpad = if image_height i < min_h then background_fill (image_width i) (min_h - image_height i) else empty_image- row_ops_for_image mrow_ops ((i <|> hpad) <-> vpad) bg region skip_dim y remaining_columns+ row_ops_for_image mrow_ops ((i <|> hpad) <-> vpad) bg region skip_dim y remaining_columns remain_rows snoc_text_span :: Attr -- the display attributes of the text span -> DisplayString -- the text to output@@ -281,7 +283,7 @@ else if ( used_display_columns + char_display_width ) > remaining_columns then do Vector.unsafeWrite mspan_chars used_char_count '…'- return $! ( used_display_columns+ return $! ( used_display_columns + 1 , display_columns_skipped , used_char_count + 1 )
test/Makefile view
@@ -30,7 +30,6 @@ -package parallel \ -package deepseq-1.1.0.2 \ -hide-package transformers \- -hide-package monads-fd \ -hide-package monads-tf \ -package QuickCheck-2.4 \ -ignore-package vty \
vty.cabal view
@@ -1,5 +1,5 @@ Name: vty-Version: 4.7.0.4+Version: 4.7.0.6 License: BSD3 License-file: LICENSE Author: Stefan O'Rear, Corey O'Connor