TermBuf::Sink
Stability: stable — changes only in a major release.
One output of a Buffer: what that output is believed to be showing, what
it has yet to be told, and the painter and encoder that tell it.
The buffer holds the cells an application drew. Everything about where they go lives here, so a second output — a web terminal, a recording, a second window — is a second sink over the same buffer rather than a second buffer kept in step with the first. Two sinks paint at different moments and know different things about what their terminals can do, which is why the front grid, the damage, the painter and the encoder all come in pairs with them.
A sink holds no IO. It turns a buffer into bytes; carrying them to a device is the driver's job.
buffer = TermBuf::Buffer.new 80, 24
sink = TermBuf::Sink.new buffer, TermBuf::Capabilities::XTERM
buffer.write 0, 0, "hello"
bytes = sink.encoder.encode sink.paint
sink.commit
Constants
What the cell a forced repaint leaves in the front grid holds: a character no buffer can contain, so every cell compares unequal and the next paint rewrites the screen.
Constructors
An output of buffer for a terminal that can do capabilities, attached
to the buffer as it is made. A sink over a buffer that already holds
content knows nothing about the screen in front of it, so call
#invalidate before the first paint.
Instance methods
Replaces what this sink may use. The next paint should be forced, since what is on the terminal was drawn under the old mask.
Whether to write the cell after a glyph that may have painted outside its
own columns. See Painter#clear_overhang?.
Whether to write the cell after a glyph that may have painted outside its
own columns. See Painter#clear_overhang?.
Brings the front grid up to date after a paint has been written out, and clears the damage and the scroll hints it was built from.
The serial of the newest scroll hint this sink has read. See
ScrollHint#serial.
What this sink has yet to paint. Its own, because a sink committing must not tell another sink over the same buffer that its rows are clean.
Stops painting the buffer. A detached sink keeps what it was showing but is told nothing further.
Where to leave the terminal's own cursor when the frame ends, or nil to
leave it hidden. See Painter#hardware_cursor.
Where to leave the terminal's own cursor when the frame ends, or nil to
leave it hidden. See Painter#hardware_cursor.
Forgets what this terminal was showing, so the next paint rewrites every cell. Any scroll hint goes with it: a screen being redrawn outright has nothing to scroll.
The operations that bring this sink's terminal up to date. Empty when
there is nothing to do. The caller encodes them, writes them out, and
then calls #commit.
forced throws away what the terminal was believed to be showing first, so the frame rewrites every cell.
Whether the front grid holds what the application drew, which is to say a paint would emit no cells.
Works out the operations. One per sink: the decisions it makes turn on the capability mask and on what this front grid holds.
Forgets what the terminal was last told about its cursor and style, so the next frame says both again.
Follows the buffer to a new size. Called by Buffer#resize, which has
already resized the back grid and this sink's damage with it.
The cluster this terminal was found to misplace, and forgets it. See
Painter#take_composed_drift.
The scroll hints this sink has not read yet, oldest first. Reading them is what lets the buffer forget them.
Whether to watch for a cluster this terminal will put in the wrong place.
See Painter#watch_composed_drift?.
Whether to watch for a cluster this terminal will put in the wrong place.
See Painter#watch_composed_drift?.