@@ -149,7 +149,6 @@ outputPicture dc pic = liftIO $ do
149149 (Vector.toList ops)
150150 -- build the Write corresponding to the output image
151151 out = (if manipCursor then writeHideCursor dc else mempty)
152− `mappend` writeDefaultAttr dc
153152 `mappend` writeOutputOps dc initialAttr diffs ops
154153 `mappend`
155154 (case picCursor pic of
@@ -167,30 +166,31 @@ outputPicture dc pic = liftIO $ do
167166 writeIORef (assumedStateRef $ contextDevice dc) as'
168167
169168writeOutputOps :: DisplayContext -> FixedAttr -> [Bool] -> DisplayOps -> Write
170−writeOutputOps dc inFattr diffs ops =
171− let (_, out, _, _) = Vector.foldl' writeOutputOps'
172− (0, mempty, inFattr, diffs)
169+writeOutputOps dc initialAttr diffs ops =
170+ let (_, out, _) = Vector.foldl' writeOutputOps'
171+ (0, mempty, diffs)
173172 ops
174173 in out
175174 where
176− writeOutputOps' (y, out, fattr, True : diffs') spanOps
177− = let (spanOut, fattr') = writeSpanOps dc y fattr spanOps
178− in (y+1, out `mappend` spanOut, fattr', diffs')
179− writeOutputOps' (y, out, fattr, False : diffs') _spanOps
180− = (y + 1, out, fattr, diffs')
181− writeOutputOps' (_y, _out, _fattr, []) _spanOps
175+ writeOutputOps' (y, out, True : diffs') spanOps
176+ = let spanOut = writeSpanOps dc y initialAttr spanOps
177+ out' = out `mappend` spanOut
178+ in (y+1, out', diffs')
179+ writeOutputOps' (y, out, False : diffs') _spanOps
180+ = (y + 1, out, diffs')
181+ writeOutputOps' (_y, _out, []) _spanOps
182182 = error "vty - output spans without a corresponding diff."
183183
184−writeSpanOps :: DisplayContext -> Int -> FixedAttr -> SpanOps -> (Write, FixedAttr)
185−writeSpanOps dc y inFattr spanOps =
184+writeSpanOps :: DisplayContext -> Int -> FixedAttr -> SpanOps -> Write
185+writeSpanOps dc y initialAttr spanOps =
186186 -- The first operation is to set the cursor to the start of the row
187− let start = writeMoveCursor dc 0 y
187+ let start = writeMoveCursor dc 0 y `mappend` writeDefaultAttr dc
188188 -- then the span ops are serialized in the order specified
189− in Vector.foldl' (\(out, fattr) op -> case writeSpanOp dc op fattr of
190− (opOut, fattr') -> (out `mappend` opOut, fattr')
191− )
192− (start, inFattr)
193− spanOps
189+ in fst $ Vector.foldl' (\(out, fattr) op -> case writeSpanOp dc op fattr of
190+ (opOut, fattr') -> (out `mappend` opOut, fattr')
191+ )
192+ (start, initialAttr)
193+ spanOps
194194
195195writeSpanOp :: DisplayContext -> SpanOp -> FixedAttr -> (Write, FixedAttr)
196196writeSpanOp dc (TextSpan attr _ _ str) fattr =
@@ -201,7 +201,7 @@ writeSpanOp dc (TextSpan attr _ _ str) fattr =
201201 `mappend` writeUtf8Text (T.encodeUtf8 $ TL.toStrict str)
202202 in (out, fattr')
203203writeSpanOp _dc (Skip _) _fattr = error "writeSpanOp for Skip"
204−writeSpanOp dc (RowEnd _) fattr = (writeRowEnd dc, fattr)
204+writeSpanOp dc (RowEnd _) fattr = (writeDefaultAttr dc `mappend` writeRowEnd dc, fattr)
205205
206206-- | The cursor position is given in X,Y character offsets. Due to multi-column characters this
207207-- needs to be translated to column, row positions.