on master help sign in
fixes. all auto tests pass
9952a90Corey O'Connor
src/Graphics/Vty/Image.hs+3−2
@@ -76,7 +76,8 @@ horiz_join EmptyImage i = i
76horiz_join i EmptyImage = i
76horiz_join i EmptyImage = i
77horiz_join i_0@(HorizText a_0 t_0 w_0 cw_0) i_1@(HorizText a_1 t_1 w_1 cw_1)
77horiz_join i_0@(HorizText a_0 t_0 w_0 cw_0) i_1@(HorizText a_1 t_1 w_1 cw_1)
78 | a_0 == a_1 = HorizText a_0 (TL.append t_0 t_1) (w_0 + w_1) (cw_0 + cw_1)
78 | a_0 == a_1 = HorizText a_0 (TL.append t_0 t_1) (w_0 + w_1) (cw_0 + cw_1)
79+ -- TODO: assumes horiz text height is always 1
79− | otherwise = HorizJoin i_0 i_1 (w_0 + w_1) (image_height i_0 + image_height i_1)
80+ | otherwise = HorizJoin i_0 i_1 (w_0 + w_1) 1
80horiz_join i_0 i_1
81horiz_join i_0 i_1
81 -- If the images are of the same height then no padding is required
82 -- If the images are of the same height then no padding is required
82 | h_0 == h_1 = HorizJoin i_0 i_1 w h_0
83 | h_0 == h_1 = HorizJoin i_0 i_1 w h_0
@@ -107,7 +108,7 @@ vert_join :: Image -> Image -> Image
107vert_join EmptyImage i = i
108vert_join EmptyImage i = i
108vert_join i EmptyImage = i
109vert_join i EmptyImage = i
109vert_join i_0 i_1
110vert_join i_0 i_1
110− -- If the images are of the same height then no background padding is required
111+ -- If the images are of the same width then no background padding is required
111 | w_0 == w_1 = VertJoin i_0 i_1 w_0 h
112 | w_0 == w_1 = VertJoin i_0 i_1 w_0 h
112 -- Otherwise one of the images needs to be padded to the size of the other image.
113 -- Otherwise one of the images needs to be padded to the size of the other image.
113 | w_0 < w_1
114 | w_0 < w_1
src/Graphics/Vty/Image/Internal.hs+4−4
@@ -101,10 +101,10 @@ data Image =
101
101
102instance Show Image where
102instance Show Image where
103 show ( HorizText { attr, display_text, output_width, char_width } )
103 show ( HorizText { attr, display_text, output_width, char_width } )
104− = "HorizText \"" ++ show display_text ++ "\""
104+ = "HorizText " ++ show display_text
105− ++ "@(" ++ show attr ++ ","
105+ ++ "@(" ++ show attr ++ ","
106− ++ show output_width ++ ","
106+ ++ show output_width ++ ","
107− ++ show char_width ++ ")"
107+ ++ show char_width ++ ")"
108 show ( BGFill { output_width, output_height } )
108 show ( BGFill { output_width, output_height } )
109 = "BGFill (" ++ show output_width ++ "," ++ show output_height ++ ")"
109 = "BGFill (" ++ show output_width ++ "," ++ show output_height ++ ")"
110 show ( HorizJoin { part_left = l, part_right = r, output_width = c } )
110 show ( HorizJoin { part_left = l, part_right = r, output_width = c } )
src/Graphics/Vty/Span.hs+5−6
@@ -167,7 +167,7 @@ build_spans pic out_region = do
167 let full_build = do
167 let full_build = do
168 start_image_build $ pic_image pic
168 start_image_build $ pic_image pic
169 -- Fill in any unspecified columns with the background pattern.
169 -- Fill in any unspecified columns with the background pattern.
170− forM_ [0 .. (region_height out_region - 1)] add_row_completion
170+ forM_ [0 .. (region_height out_region - 1)] (add_row_completion out_region)
171 init_env = BlitEnv (pic_background pic) out_region out_ops
171 init_env = BlitEnv (pic_background pic) out_region out_ops
172 init_state = BlitState 0 0 0 0 (region_width out_region) (region_height out_region)
172 init_state = BlitState 0 0 0 0 (region_width out_region) (region_height out_region)
173 _ <- runStateT (runReaderT full_build init_env) init_state
173 _ <- runStateT (runReaderT full_build init_env) init_state
@@ -211,7 +211,7 @@ add_unclipped (BGFill ow oh) = do
211 Background c a <- view bg
211 Background c a <- view bg
212 y <- use row_offset
212 y <- use row_offset
213 let op = TextSpan ow ow (T.encodeUtf8 $ T.replicate (fromIntegral ow) (T.singleton c))
213 let op = TextSpan ow ow (T.encodeUtf8 $ T.replicate (fromIntegral ow) (T.singleton c))
214− forM_ [y..y+oh] $ \row -> do
214+ forM_ [y..y+oh-1] $ \row -> do
215 snoc_op (AttributeChange a) row
215 snoc_op (AttributeChange a) row
216 snoc_op op row
216 snoc_op op row
217-- TODO: we know it's clipped actually, the equations that are exposed that introduce a
217-- TODO: we know it's clipped actually, the equations that are exposed that introduce a
@@ -253,7 +253,7 @@ add_maybe_clipped (VertJoin top_image bottom_image _ow oh) = do
253 oh
253 oh
254add_maybe_clipped (HorizJoin left_image right_image ow _oh) = do
254add_maybe_clipped (HorizJoin left_image right_image ow _oh) = do
255 add_maybe_clipped_join "horiz_join" skip_columns remaining_columns column_offset
255 add_maybe_clipped_join "horiz_join" skip_columns remaining_columns column_offset
256− (image_width right_image)
256+ (image_width left_image)
257 left_image
257 left_image
258 right_image
258 right_image
259 ow
259 ow
@@ -336,11 +336,10 @@ add_unclipped_text txt = do
336
336
337-- todo: If there is no background pattern defined then skip to next line.
337-- todo: If there is no background pattern defined then skip to next line.
338-- todo: assumes background character is 1 column
338-- todo: assumes background character is 1 column
339−add_row_completion :: Int -> BlitM s ()
339+add_row_completion :: DisplayRegion -> Int -> BlitM s ()
340−add_row_completion row = do
340+add_row_completion display_region row = do
341 all_row_ops <- view mrow_ops
341 all_row_ops <- view mrow_ops
342 Background c a <- view bg
342 Background c a <- view bg
343− display_region <- view region
344 row_ops <- lift $ lift $ Vector.read all_row_ops row
343 row_ops <- lift $ lift $ Vector.read all_row_ops row
345 let end_x = span_ops_effected_columns row_ops
344 let end_x = span_ops_effected_columns row_ops
346 when (end_x < region_width display_region) $ do
345 when (end_x < region_width display_region) $ do
src/Graphics/Vty/Terminal.hs−1
@@ -41,7 +41,6 @@ import Control.Monad
41import Control.Monad.Trans
41import Control.Monad.Trans
42
42
43import Data.List ( isPrefixOf )
43import Data.List ( isPrefixOf )
44−import Data.Word
45
44
46import System.Environment
45import System.Environment
47
46
test/Verify/Graphics/Vty/Image.hs+1−1
@@ -54,7 +54,7 @@ instance Arbitrary SingleRowSingleAttrImage where
54 return $ SingleRowSingleAttrImage
54 return $ SingleRowSingleAttrImage
55 a
55 a
56 ( fromIntegral $ length single_column_row_text )
56 ( fromIntegral $ length single_column_row_text )
57− ( horiz_cat $ [ char attr c | (SingleColumnChar c, attr) <- single_column_row_text ] )
57+ ( horiz_cat $ [ char a c | SingleColumnChar c <- single_column_row_text ] )
58
58
59data SingleRowTwoAttrImage
59data SingleRowTwoAttrImage
60 = SingleRowTwoAttrImage
60 = SingleRowTwoAttrImage