| ScreenBuffer | R Documentation |
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.
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.
ScreenBuffer$new()Create a blank buffer.
ScreenBuffer$new(width, height)
width, heightSize in cells.
ScreenBuffer$clear()Reset every cell to a blank default cell.
ScreenBuffer$clear()
ScreenBuffer$bounds()The full-buffer rectangle.
ScreenBuffer$bounds()
ScreenBuffer$get_cell()Read one cell.
ScreenBuffer$get_cell(x, y)
x, yColumn and row.
ScreenBuffer$set_cell()Write one cell (see cell()).
ScreenBuffer$set_cell(x, y, cell)
x, yColumn and row.
cellA termr_cell.
ScreenBuffer$fill()Fill a region with one character and style.
ScreenBuffer$fill(region = NULL, char = " ", fg = NULL, bg = NULL, attrs = 0L)
regionA region(); defaults to the whole buffer.
charA single-width character.
fg, bgColours (see style()).
attrsAttribute bit mask.
ScreenBuffer$paint_background()Set only the background colour of a region.
ScreenBuffer$paint_background(region, bg)
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.
ScreenBuffer$put_text( x, y, text, fg = NULL, bg = NULL, attrs = 0L, clip = NULL )
x, yColumn and row of the first character.
textA single string (no newlines).
fgForeground colour.
bgBackground colour. NULL keeps the existing background,
so text can be drawn over a painted widget background.
attrsAttribute bit mask.
clipOptional clipping region().
The column after the last character, invisibly.
ScreenBuffer$resize()Change the buffer size, keeping the top-left content.
ScreenBuffer$resize(width, height)
width, heightNew size.
ScreenBuffer$copy()An independent copy of the buffer.
ScreenBuffer$copy()
ScreenBuffer$equals()Do two buffers hold exactly the same cells?
ScreenBuffer$equals(other)
otherAnother ScreenBuffer.
ScreenBuffer$to_text()The buffer as plain text, one string per row.
ScreenBuffer$to_text()
ScreenBuffer$print()Print the buffer contents framed by a border.
ScreenBuffer$print(...)
...Ignored.
ScreenBuffer$clone()The objects of this class are cloneable with this method.
ScreenBuffer$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.