class
TUI::Screen
- TUI::Screen
- Reference
- Object
Defined in:
tui/core/screen.crConstructors
Instance Method Summary
-
#at(row : Int32, col : Int32, s : String) : Nil
Write directly into the back buffer at absolute terminal coordinates.
-
#blit(x : Int32, y : Int32, buffer : Buffer) : Nil
Composite a widget's local buffer onto the back buffer at (x, y).
-
#cell(row : Int32, col : Int32) : BufferCell
Read back a cell from the back buffer — the one composited widgets have just blitted into, before the next #flush swaps it to front.
- #cols : Int32
-
#flush : Nil
Diff @back against @front, emit only changed cells, then swap.
- #refresh_size : Nil
-
#rows : Int32
Current terminal size in character cells, refreshed by #refresh_size on resize.
-
#status_bar(row : Int32, text : String) : Nil
Status bar: fill entire row with reverse-video text (absolute coords).
-
#status_bar_style : Style
Applied to the whole row drawn by #status_bar.
-
#status_bar_style=(status_bar_style : Style)
Applied to the whole row drawn by #status_bar.
-
#vline(x : Int32, y : Int32, h : Int32) : Nil
Draw a vertical line at absolute terminal coordinates, e.g.
-
#with_clip(rect : ClipRect, & : -> Nil) : Nil
Bounds every #blit inside
blocktorect, intersected with whatever clip is already active (so a clip can only narrow, never widen, no matter how many containers are nested).
Constructor Detail
Instance Method Detail
Write directly into the back buffer at absolute terminal coordinates. For App-level drawing that isn't owned by any single widget (status bar, dividers between panes).
Composite a widget's local buffer onto the back buffer at (x, y). x/y are 1-based terminal coordinates (matching Widget#x/#y convention). Cells landing outside the currently active #with_clip rect (if any) are silently dropped, same "out of bounds is a no-op, not an error" convention Buffer#set_cell already uses for the screen's own edges.
Read back a cell from the back buffer — the one composited widgets have just blitted into, before the next #flush swaps it to front. Exists for specs to assert on composited output; app code should never need to read cells back out of the screen it just drew.
Diff @back against @front, emit only changed cells, then swap.
The real terminal cursor stays hidden across frames — apps draw their own selection highlight (reverse-video rows, block glyphs for text input) rather than relying on the terminal's cursor to convey position. A caller that needs the native cursor visible (e.g. a text field mid-edit) should show it and move it itself after calling flush, then hide it again before the next flush.
Current terminal size in character cells, refreshed by #refresh_size on resize. 0-based row/col math elsewhere in this class treats these as the exclusive upper bound.
Status bar: fill entire row with reverse-video text (absolute coords).
Applied to the whole row drawn by #status_bar.
Draw a vertical line at absolute terminal coordinates, e.g. a divider between two side-by-side widget panes.
Bounds every #blit inside block to rect, intersected with
whatever clip is already active (so a clip can only narrow, never
widen, no matter how many containers are nested). Always restores
the previous clip afterward, even if block raises, so a
container's own clip can never leak past its own #composite call.
Default (@clip nil) is "no bound" — existing callers that never
call #with_clip see zero behavior change.