A ScreenBuffer is an in-memory grid of terminal cells. Widgets are
painted into a buffer, buffers are compared with diff_screen() and only
the differences are sent to the terminal.
Cells are stored in four height x width matrices (chars, fg, bg,
attrs) indexed as [row, column]. A wide character occupies two
columns: the first holds the character, the second holds "" (a
continuation cell). All writes keep this invariant, so a wide character
is never left half-overwritten.
Use screen_buffer() to create one.
Public fields
widthNumber of columns.
heightNumber of rows.
charsCharacter matrix of cell contents.
fgCharacter matrix of canonical foreground colours.
bgCharacter matrix of canonical background colours.
attrsInteger matrix of attribute bit masks.
Methods
ScreenBuffer$set_cell()
Write one cell (see cell()).
ScreenBuffer$paint_background()
Set only the background colour of a region.
Arguments
regionA
region().bgColour.
ScreenBuffer$put_text()
Write a single line of text.
Text is clipped to clip (and to the buffer). A wide character that
would straddle the clip edge is replaced by a space. Control
characters are removed.
Arguments
x, yColumn and row of the first character.
textA single string (no newlines).
fgForeground colour.
bgBackground colour.
NULLkeeps the existing background, so text can be drawn over a painted widget background.attrsAttribute bit mask.
clipOptional clipping
region().