@@ -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
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
@@ -336,11 +336,10 @@ add_unclipped_text txt = do
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