class

Egui::Terminal::Grid

Inherits Reference < Object

Constructors

new(cols : Int32, rows : Int32, scrollback : Int32)
Source

Instance methods

blank_line(bg : TermColor) : Array(Cell)
Source
blank_line
Source
clear_scrollback
Source
cols
Source
delete_lines(y : Int32, n : Int32, bottom : Int32) : Nil
Source
insert_lines(y : Int32, n : Int32, bottom : Int32) : Nil

Insert/delete n blank lines at row y (scroll region work — rows below y inside the region shift down/up). Lines pushed past the region bottom are lost; rows OUTSIDE the region stay. Delete before insert: an insert-first shuffle would drift the deque's tail (the visible window is its last rows lines).

Source
line(y : Int32) : Array(Cell)
Source
line_index(y : Int32) : Int32

Deque index of screen row y (no display offset).

Source
line_text(y : Int32) : String

Plain text of one line, trailing blanks trimmed.

Source
lines
Source
resize(new_cols : Int32, new_rows : Int32, reflow : Bool = true, track : Int32 | Nil = nil) : Int32 | Nil

Resize with canonical reflow (the gnome-terminal/alacritty model): the buffer regroups into LOGICAL lines — a row whose first cell carries the WRAPPED flag continues the one above — and re-wraps each at the new width, exactly as if its text had been PRINTED there. Idempotent from any prior fragmentation: a shrink by one column yields full rows plus one short tail, not 1-char remainder fragments. reflow: false (the alternate screen) keeps the plain xterm truncate/pad behavior — full-screen apps redraw themselves on SIGWINCH. track is a line index carried through the reflow and the scrollback-cap trims — the caller uses it to keep the cursor on its line; returns the updated index (or nil).

Row changes are xterm-style without reflow: growing reveals scrollback lines above the content and pads BLANK ROWS AT THE BOTTOM (content stays top-anchored — a fresh 24-row screen resized to 34 keeps its prompt on row 0); shrinking pushes the surplus top rows into the scrollback, so the bottom stays visible.

Source
rows
Source
scroll_down(n : Int32, top = 0, bottom = -1) : Nil

Scroll the region [top, bottom] down by n (blank lines enter at the top of the region; the region's bottom lines are lost, rows outside stay — delete before insert, like insert_lines).

Source
scroll_up(n : Int32, top = 0, bottom = -1, history = false) : Nil

Scroll the region [top, bottom] up by n. When history is set and the region is the full screen, lines leaving the top land in the scrollback (they simply stay in the deque while new lines are appended at the bottom); otherwise they are lost.

Source
scrollback
Source
scrollback_used
Source
visible_index(display_offset : Int32, y : Int32) : Int32

Deque index of screen row y shown display_offset lines back.

Source