Skip to content
ConsoleMonster
Class

TerminalSize

ConsoleMonster.Output

Namespace
ConsoleMonster.Output
Assembly
ConsoleMonster
Modifiers
static

Reads the visible window size, rather than the scrollback buffer; safe to call every frame.

Inheritance

  • object
  • TerminalSize

Methods

public static bool TryGet(out int width, out int height) #

Tries to read the visible size without throwing.

Parameters

width int required
Columns, or zero when unavailable.
height int required
Rows, or zero when unavailable.

Returns

bool Whether a positive size was read.
public static bool TryGetWindow(out int left, out int top, out int width, out int height) #

Reads the visible window's position in the screen buffer and its size. On Windows consoles the position changes when the user scrolls the window; elsewhere it is always (0, 0).

Parameters

left int required
The window's left column in the buffer.
top int required
The window's top row in the buffer.
width int required
The window width in cells.
height int required
The window height in cells.

Returns

bool True when the window could be read.