moo.shell.window.WindowState
- class moo.shell.window.WindowState(height=1, title=None, quiet=False)
Mutable screen state shared between the driver and the Application.
The top region is a sparse grid of cells keyed by
(row, col)holding Rich markup.window_writesets a cell directly;window_cursor+window_emitprovide a stateful cursor for translatingset_cursor+printsequences. The scroll region is a bounded list of pre-rendered ANSI lines; the visible slice is always the tail that fits.Overlapping writes on a row are laid left-to-right by column; partial mid-segment overwrite is not modelled in v1 (writes at distinct columns, the common case, compose correctly).
- __init__(height=1, title=None, quiet=False)
Methods
__init__([height, title, quiet])append_output(ansi_text)Append already-ANSI-rendered output, split into lines.
clear([row])Clear the whole top region, or a single
row.emit(text)Write
textat the cursor and advance it (newlines wrap to col 0).move_cursor(row, col)Move the emit cursor to
(row, col).render_scroll(visible)Return the last
visiblescroll lines as ANSI.render_top()Composite the top grid into an ANSI block of
heightrows.set_height(height)Resize the top region to
heightrows.write(row, col, text)Place
text(markup) at(row, col)and park the cursor after it.