@@ -88,6 +88,8 @@ display_context t r = liftIO $ do
88 , serialize_set_attr = serialize_set_attr self
88 , serialize_set_attr = serialize_set_attr self
89 , default_attr_required_bytes = default_attr_required_bytes self
89 , default_attr_required_bytes = default_attr_required_bytes self
90 , serialize_default_attr = serialize_default_attr self
90 , serialize_default_attr = serialize_default_attr self
91+ , row_end_required_bytes = row_end_required_bytes self
92+ , serialize_row_end = serialize_row_end self
91 , inline_hack = return ()
93 , inline_hack = return ()
93 mfix (mk_display_context t . def_context)
95 mfix (mk_display_context t . def_context)
@@ -120,6 +122,8 @@ data DisplayContext = DisplayContext
120 -- | Reset the display attributes to the default display attributes
122 -- | Reset the display attributes to the default display attributes
121 , default_attr_required_bytes :: Int
123 , default_attr_required_bytes :: Int
122 , serialize_default_attr :: OutputBuffer -> IO OutputBuffer
124 , serialize_default_attr :: OutputBuffer -> IO OutputBuffer
125+ , row_end_required_bytes :: Int
126+ , serialize_row_end :: OutputBuffer -> IO OutputBuffer
123 -- | See Graphics.Vty.Terminal.XTermColor.inline_hack
127 -- | See Graphics.Vty.Terminal.XTermColor.inline_hack
124 , inline_hack :: IO ()
128 , inline_hack :: IO ()
@@ -236,7 +240,7 @@ span_op_required_bytes dc fattr (AttributeChange attr) =
236 in (c, fattr')
240 in (c, fattr')
237span_op_required_bytes _dc fattr (TextSpan _ _ str) = (utf8_text_required_bytes str, fattr)
241span_op_required_bytes _dc fattr (TextSpan _ _ str) = (utf8_text_required_bytes str, fattr)
238span_op_required_bytes _dc _fattr (Skip _) = error "span_op_required_bytes for Skip."
242span_op_required_bytes _dc _fattr (Skip _) = error "span_op_required_bytes for Skip."
239−span_op_required_bytes _dc fattr (RowEnd _) = (0,fattr)
243+span_op_required_bytes dc fattr (RowEnd _) = (row_end_required_bytes dc, fattr)
241serialize_output_ops :: DisplayContext
245serialize_output_ops :: DisplayContext
242 -> OutputBuffer
246 -> OutputBuffer
@@ -272,6 +276,8 @@ serialize_span_ops dc y out_ptr in_fattr span_ops = do
272 (out_ptr', in_fattr)
276 (out_ptr', in_fattr)
280+-- TODO: move this into the terminal implementation?
275serialize_span_op :: DisplayContext
281serialize_span_op :: DisplayContext
276 -> SpanOp
282 -> SpanOp
277 -> OutputBuffer
283 -> OutputBuffer
@@ -287,7 +293,9 @@ serialize_span_op _dc (TextSpan _ _ str) out_ptr fattr = do
287 out_ptr' <- serialize_utf8_text str out_ptr
293 out_ptr' <- serialize_utf8_text str out_ptr
288 return (out_ptr', fattr)
294 return (out_ptr', fattr)
289serialize_span_op _dc (Skip _) _out_ptr _fattr = error "serialize_span_op for Skip"
295serialize_span_op _dc (Skip _) _out_ptr _fattr = error "serialize_span_op for Skip"
290−serialize_span_op _dc (RowEnd _) out_ptr fattr = return (out_ptr, fattr)
296+serialize_span_op dc (RowEnd _) out_ptr fattr = do
297+ out_ptr' <- serialize_row_end dc out_ptr
298+ return (out_ptr', fattr)
292send_to_terminal :: Terminal -> Int -> (Ptr Word8 -> IO (Ptr Word8)) -> IO ()
300send_to_terminal :: Terminal -> Int -> (Ptr Word8 -> IO (Ptr Word8)) -> IO ()
293send_to_terminal t c f = allocaBytes (fromEnum c) $ \start_ptr -> do
301send_to_terminal t c f = allocaBytes (fromEnum c) $ \start_ptr -> do