Skip to content
ConsoleMonster
Class

InlineArea

ConsoleMonster.Live

Namespace
ConsoleMonster.Live
Assembly
ConsoleMonster
Implements
IDisposable
Modifiers
sealed

A few lines below the cursor, drawn on demand on the calling thread (no render thread), on a console that other code writes to at the same time, such as PowerShell's warnings or Write-Host. Before each draw the area checks the console buffer for its own lines: when nothing was written after them they are redrawn in place; when other output came after them, the old lines are deleted (the output below moves up) and the area is drawn again under that output, so nothing is overwritten and no stale copy stays behind. InlineArea.Clear removes the area the same way. It needs a Windows console whose buffer can be read (Windows Terminal, conhost); see InlineArea.IsSupported. Enable-ConsoleFormatting -Feature Progress draws Write-Progress with it.

Inheritance

  • object
  • InlineArea

Constructors

public InlineArea(TerminalProfile? profile = null) #

Creates an area on the current console.

Parameters

profile ConsoleMonster.Capabilities.TerminalProfile? = null optional
The terminal profile, or null for the current one.

Methods

public void Abandon() #

Forgets the area without touching the screen (it stays as printed text).

public void Clear() #

Removes the area; later output starts where it was (or, after other output, where that output ended).

public void Dispose() #

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Draw 2 overloads
public void Draw(IWidget widget, RenderContext? context = null) #

Draws a widget as the area's new content, as tall as it needs (at most the window height minus one).

Parameters

widget ConsoleMonster.Layout.IWidget required
The content.
context ConsoleMonster.Canvas.RenderContext? = null optional
The render context (for example with a clock for elapsed times), or null for the terminal's.
public void Draw(CellBuffer frame) #

Draws a rendered frame as the area's new content.

Parameters

frame ConsoleMonster.Canvas.CellBuffer required
The frame; one row per line.
public static bool IsSupported(TerminalProfile? profile = null) #

Whether an area can be drawn on the current console: an interactive Windows console whose buffer can be read.

Parameters

profile ConsoleMonster.Capabilities.TerminalProfile? = null optional
The terminal profile, or null for the current one.

Returns

bool True when InlineArea.Draw works here.

Properties

public int Height { get; } #

The rows the area occupies now (0 when it is not shown).

public int MaxWidth { get; set; } #

The widest the content is drawn (0, the default, for the console's width), so short rows keep their right-aligned parts close.

public int Width { get; } #

The width content is drawn at: the console's width less one column, so a full row never wraps (at most InlineArea.MaxWidth).