class

TUI::Buffer

Inherits Reference < Object

A widget-local grid of cells. Widgets draw into their own Buffer using coordinates relative to their own top-left (0, 0) — never absolute terminal coordinates. The compositor (Screen) blits each widget's Buffer onto the real screen at the widget's x/y offset.

Constructors

new(width : Int32, height : Int32)
Source

Instance methods

box(y : Int32, x : Int32, h : Int32, w : Int32, title : String = "", style : Style = Style.new) : Nil

Draw a box with an optional title in the top border, in local coords. style applies only to the border glyphs themselves — a title's own text is drawn plain here (its emphasis, if any, is the widget's own concern, e.g. ListView#title_style) so it doesn't inherit the border's color.

Source
box_with_divider(y : Int32, x : Int32, h : Int32, w : Int32, divider_at : Int32, title : String = "", style : Style = Style.new) : Nil

Draw a box like #box, but with a T-junction character injected into the top and bottom border rows at local column divider_at — used by SplitWindow to merge its internal pane divider into the outer border. This is a degenerate single-divider stamp (draw a plain box, then overwrite one cell per row) rather than a composed Term.border_line call — it doesn't contain segment/junction math to unify, and rebuilding it in those terms would risk changing how a title long enough to reach divider_at currently gets partially overwritten by the injected junction glyph.

Source
cell(row : Int32, col : Int32) : BufferCell
Source
clear
Source
height
Source
hline(y : Int32, x : Int32, w : Int32, left_join : Bool = false, right_join : Bool = false, style : Style = Style.new) : Nil

Draw a horizontal separator spanning w columns at (y, x). left_join / right_join use ├ / ┤ instead of └ / ┘.

Source
scrollbar(y : Int32, x : Int32, h : Int32, fraction : Float64 | Nil, visible : Int32 = 0, total : Int32 = 0, style : Style = Style.new, inset : Int32 = 1) : Nil

Draws a vertical scrollbar in column x, h rows tall starting at y. fraction is the 0.0 (top) to 1.0 (bottom) position of the viewport, visible/total size the thumb proportionally. fraction nil means no scrollbar (content fits entirely, nothing to indicate). inset reserves that many rows off each end of h before drawing — the default of 1 matches the original use (a box's own top/bottom border rows straddle the track); pass inset: 0 to span the full h rows, e.g. a borderless field with no border rows to skip (see ScrollableField#render).

Source
set(row : Int32, col : Int32, s : String) : Nil

Write a string starting at local (row, col), 0-indexed. ANSI escape sequences in s are tracked as the running style and attached to each subsequent plain character's cell, rather than being written as their own cells — this lets the compositor diff on (char, style) per cell.

Source
set_cell(row : Int32, col : Int32, cell : BufferCell) : Nil
Source
vline(x : Int32, y : Int32, h : Int32, style : Style = Style.new) : Nil

Draw a vertical line of h rows starting at (y, x), local coords.

Source
width

Fixed size in cells, set at construction. A widget wanting a different size builds a new Buffer (see Widget#composite) rather than resizing this one in place.

Source