@@ -121,14 +121,13 @@ substitute_skips (Background {background_char, background_attr}) ops = do
121 return ops
121 return ops
123swap_skips_for_single_column_char_span :: Char -> Attr -> SpanOps -> SpanOps
123swap_skips_for_single_column_char_span :: Char -> Attr -> SpanOps -> SpanOps
124−swap_skips_for_single_column_char_span c a = Vector.concatMap f
124+swap_skips_for_single_column_char_span c a = Vector.map f
125 where f (Skip ow) = let txt = T.pack $ replicate ow c
125 where f (Skip ow) = let txt = T.pack $ replicate ow c
126− in Vector.cons (AttributeChange a)
127− (Vector.singleton $ TextSpan ow ow (T.encodeUtf8 txt))
126+ in TextSpan a ow ow (T.encodeUtf8 txt)
128− f v = Vector.singleton v
127+ f v = v
130swap_skips_for_char_span :: Int -> Char -> Attr -> SpanOps -> SpanOps
129swap_skips_for_char_span :: Int -> Char -> Attr -> SpanOps -> SpanOps
131−swap_skips_for_char_span w c a = Vector.concatMap f
130+swap_skips_for_char_span w c a = Vector.map f
133 f (Skip ow) = let txt_0_cw = ow `div` w
132 f (Skip ow) = let txt_0_cw = ow `div` w
134 txt_0 = T.pack $ replicate txt_0_cw c
133 txt_0 = T.pack $ replicate txt_0_cw c
@@ -136,9 +135,8 @@ swap_skips_for_char_span w c a = Vector.concatMap f
136 txt_1 = T.pack $ replicate txt_1_cw '…'
135 txt_1 = T.pack $ replicate txt_1_cw '…'
137 cw = txt_0_cw + txt_1_cw
136 cw = txt_0_cw + txt_1_cw
138 txt = txt_0 `T.append` txt_1
137 txt = txt_0 `T.append` txt_1
139− in Vector.cons (AttributeChange a)
140− (Vector.singleton $ TextSpan ow cw $ T.encodeUtf8 txt)
138+ in TextSpan a ow cw $ T.encodeUtf8 txt
141− f v = Vector.singleton v
139+ f v = v
143-- | Builds a vector of row operations that will output the given picture to the terminal.
141-- | Builds a vector of row operations that will output the given picture to the terminal.
@@ -202,15 +200,14 @@ add_maybe_clipped (HorizText a text_str ow _cw) = do
202 -- TODO: assumption that text spans are only 1 row high.
200 -- TODO: assumption that text spans are only 1 row high.
203 s <- use skip_rows
201 s <- use skip_rows
204 when (s < 1) $ do
202 when (s < 1) $ do
205− use row_offset >>= snoc_op (AttributeChange a)
206 left_clip <- use skip_columns
203 left_clip <- use skip_columns
207 right_clip <- use remaining_columns
204 right_clip <- use remaining_columns
208 let left_clipped = left_clip > 0
205 let left_clipped = left_clip > 0
209 right_clipped = (ow - left_clip) > right_clip
206 right_clipped = (ow - left_clip) > right_clip
210 if left_clipped || right_clipped
207 if left_clipped || right_clipped
211 then let text_str' = clip_text text_str left_clip right_clip
208 then let text_str' = clip_text text_str left_clip right_clip
212− in add_unclipped_text text_str'
209+ in add_unclipped_text a text_str'
213− else add_unclipped_text text_str
210+ else add_unclipped_text a text_str
214add_maybe_clipped (VertJoin top_image bottom_image _ow oh) = do
211add_maybe_clipped (VertJoin top_image bottom_image _ow oh) = do
215 add_maybe_clipped_join "vert_join" skip_rows remaining_rows row_offset
212 add_maybe_clipped_join "vert_join" skip_rows remaining_rows row_offset
216 (image_height top_image)
213 (image_height top_image)
@@ -302,9 +299,9 @@ clip_text txt left_skip right_clip =
302 clip_for_char_width _ _ _ = error "clip_for_char_width applied to undefined"
299 clip_for_char_width _ _ _ = error "clip_for_char_width applied to undefined"
305−add_unclipped_text :: DisplayText -> BlitM s ()
302+add_unclipped_text :: Attr -> DisplayText -> BlitM s ()
306−add_unclipped_text txt = do
303+add_unclipped_text a txt = do
307− let op = TextSpan used_display_columns
304+ let op = TextSpan a used_display_columns
308 (fromIntegral $ TL.length txt)
305 (fromIntegral $ TL.length txt)
309 (T.encodeUtf8 $ TL.toStrict txt)
306 (T.encodeUtf8 $ TL.toStrict txt)
310 used_display_columns = wcswidth $ TL.unpack txt
307 used_display_columns = wcswidth $ TL.unpack txt