Safe Haskell | None |
---|---|
Language | Haskell2010 |
A picture is translated into a sequences of state changes and character spans.
- State changes are currently limited to new attribute values. The attribute is applied to all
- following spans. Including spans of the next row. The nth element of the sequence represents the
- nth row (from top to bottom) of the picture to render.
-
- A span op sequence will be defined for all rows and columns (and no more) of the region provided
- with the picture to spansForPic
.
-
- todo: Partition attribute changes into multiple categories according to the serialized
- representation of the various attributes.
- data SpanOp
- type SpanOps = Vector SpanOp
- dropOps :: Int -> SpanOps -> SpanOps
- splitOpsAt :: Int -> SpanOps -> (SpanOps, SpanOps)
- type DisplayOps = Vector SpanOps
- displayOpsColumns :: DisplayOps -> Int
- displayOpsRows :: DisplayOps -> Int
- effectedRegion :: DisplayOps -> DisplayRegion
- spanOpsEffectedColumns :: SpanOps -> Int
- spanOpHasWidth :: SpanOp -> Maybe (Int, Int)
- columnsToCharOffset :: Int -> SpanOp -> Int
Documentation
This represents an operation on the terminal. Either an attribute change or the output of a text string.
TextSpan | a span of UTF-8 text occupies a specific number of screen space columns. A single UTF character does not necessarially represent 1 colunm. See Codec.Binary.UTF8.Width TextSpan [Attr] [output width in columns] [number of characters] [data] |
| |
Skip !Int | Skips the given number of columns A skip is transparent.... maybe? I am not sure how attribute changes interact. todo: separate from this type. |
RowEnd !Int | Marks the end of a row. specifies how many columns are remaining. These columns will not be explicitly overwritten with the span ops. The terminal is require to assure the remaining columns are clear. todo: separate from this type. |
type SpanOps = Vector SpanOp Source
vector of span operations. executed in succession. This represents the operations required to render a row of the terminal. The operations in one row may effect subsequent rows. EG: Setting the foreground color in one row will effect all subsequent rows until the foreground color is changed.
type DisplayOps = Vector SpanOps Source
vector of span operation vectors for display. One per row of the output region.
displayOpsColumns :: DisplayOps -> Int Source
Number of columns the DisplayOps are defined for
All spans are verified to define same number of columns. See: VerifySpanOps
displayOpsRows :: DisplayOps -> Int Source
Number of rows the DisplayOps are defined for
spanOpsEffectedColumns :: SpanOps -> Int Source
The number of columns a SpanOps effects.
columnsToCharOffset :: Int -> SpanOp -> Int Source
returns the number of columns to the character at the given position in the span op