on master help sign in
fixes. all auto tests pass
commit9952a909d93ccf3eda54657483f90846f8144a12 authorCorey O'Connor <corey@ooyala.com> dateSat 1 Jun 2013, 16:34 (13 years ago) parentf3108fa
5 files changed+13−14
src/Graphics/Vty/Image.hs+3−2 src/Graphics/Vty/Image/Internal.hs+4−4 src/Graphics/Vty/Span.hs+5−6 src/Graphics/Vty/Terminal.hs−1 test/Verify/Graphics/Vty/Image.hs+1−1
src/Graphics/Vty/Image.hs+3−2
@@ -76,7 +76,8 @@ horiz_join EmptyImage i = i
7676horiz_join i EmptyImage = i
7777horiz_join i_0@(HorizText a_0 t_0 w_0 cw_0) i_1@(HorizText a_1 t_1 w_1 cw_1)
7878 | a_0 == a_1 = HorizText a_0 (TL.append t_0 t_1) (w_0 + w_1) (cw_0 + cw_1)
79− | otherwise = HorizJoin i_0 i_1 (w_0 + w_1) (image_height i_0 + image_height i_1)
79+ -- TODO: assumes horiz text height is always 1
80+ | otherwise = HorizJoin i_0 i_1 (w_0 + w_1) 1
8081horiz_join i_0 i_1
8182 -- If the images are of the same height then no padding is required
8283 | h_0 == h_1 = HorizJoin i_0 i_1 w h_0
@@ -107,7 +108,7 @@ vert_join :: Image -> Image -> Image
107108vert_join EmptyImage i = i
108109vert_join i EmptyImage = i
109110vert_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
111112 | w_0 == w_1 = VertJoin i_0 i_1 w_0 h
112113 -- Otherwise one of the images needs to be padded to the size of the other image.
113114 | w_0 < w_1
src/Graphics/Vty/Image/Internal.hs+4−4
@@ -101,10 +101,10 @@ data Image =
101101
102102instance Show Image where
103103 show ( HorizText { attr, display_text, output_width, char_width } )
104− = "HorizText \"" ++ show display_text ++ "\""
105− ++ "@(" ++ show attr ++ ","
106− ++ show output_width ++ ","
107− ++ show char_width ++ ")"
104+ = "HorizText " ++ show display_text
105+ ++ "@(" ++ show attr ++ ","
106+ ++ show output_width ++ ","
107+ ++ show char_width ++ ")"
108108 show ( BGFill { output_width, output_height } )
109109 = "BGFill (" ++ show output_width ++ "," ++ show output_height ++ ")"
110110 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
167167 let full_build = do
168168 start_image_build $ pic_image pic
169169 -- 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)
171171 init_env = BlitEnv (pic_background pic) out_region out_ops
172172 init_state = BlitState 0 0 0 0 (region_width out_region) (region_height out_region)
173173 _ <- runStateT (runReaderT full_build init_env) init_state
@@ -211,7 +211,7 @@ add_unclipped (BGFill ow oh) = do
211211 Background c a <- view bg
212212 y <- use row_offset
213213 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
215215 snoc_op (AttributeChange a) row
216216 snoc_op op row
217217-- 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
253253 oh
254254add_maybe_clipped (HorizJoin left_image right_image ow _oh) = do
255255 add_maybe_clipped_join "horiz_join" skip_columns remaining_columns column_offset
256− (image_width right_image)
256+ (image_width left_image)
257257 left_image
258258 right_image
259259 ow
@@ -336,11 +336,10 @@ add_unclipped_text txt = do
336336
337337-- todo: If there is no background pattern defined then skip to next line.
338338-- todo: assumes background character is 1 column
339−add_row_completion :: Int -> BlitM s ()
340−add_row_completion row = do
339+add_row_completion :: DisplayRegion -> Int -> BlitM s ()
340+add_row_completion display_region row = do
341341 all_row_ops <- view mrow_ops
342342 Background c a <- view bg
343− display_region <- view region
344343 row_ops <- lift $ lift $ Vector.read all_row_ops row
345344 let end_x = span_ops_effected_columns row_ops
346345 when (end_x < region_width display_region) $ do
src/Graphics/Vty/Terminal.hs−1
@@ -41,7 +41,6 @@ import Control.Monad
4141import Control.Monad.Trans
4242
4343import Data.List ( isPrefixOf )
44−import Data.Word
4544
4645import System.Environment
4746
test/Verify/Graphics/Vty/Image.hs+1−1
@@ -54,7 +54,7 @@ instance Arbitrary SingleRowSingleAttrImage where
5454 return $ SingleRowSingleAttrImage
5555 a
5656 ( 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 ] )
5858
5959data SingleRowTwoAttrImage
6060 = SingleRowTwoAttrImage